#include <string>
#include <vector>
+#include <stdio.h>
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#define ID_STRINGUTILS "$Id: string_utilities.h,v 1.13 2010/07/07 11:59:48 jberndt Exp $"
+#define ID_STRINGUTILS "$Id: string_utilities.h,v 1.14 2010/08/21 17:13:47 jberndt Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
extern std::string& to_lower(std::string& str);
extern bool is_number(const std::string& str);
std::vector <std::string> split(std::string str, char d);
+ extern std::string to_string(int);
+ extern std::string replace(std::string str, const std::string& old, const std::string& newstr);
#else
#include <cctype>
return str_array;
}
+ string to_string(int i)
+ {
+ char buffer[32];
+ sprintf(buffer, "%d", i);
+ return string(buffer);
+ }
+
+ string replace(string str, const string& oldstr, const string& newstr)
+ {
+ int old_idx;
+ string temp;
+ old_idx = str.find(oldstr);
+ if (old_idx >= 0) {
+ temp = str.replace(old_idx, 1, newstr);
+ }
+ return temp;
+ }
+
#endif
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%