--- smsdaemon/util.cpp 2008/06/10 20:25:15 38 +++ smsdaemon/util.cpp 2008/06/14 08:39:40 78 @@ -7,7 +7,7 @@ #include #include #include - +#include #include #include "util.h" @@ -42,13 +42,27 @@ return str; } - + std::string str_replace_char(std::string str, char search, char replace) + { + unsigned int pos = 0; + + while ( (pos = str.find(search,pos)) != string::npos) + { + str.replace(pos, 1, 1, replace); + } + return str; + } + + bool my_isspace(char ch) + { + return (isspace(ch) || ch == 0); + } string str_trim(string str) { - while (str.length() > 0 && isspace(str.at(0))) + while (str.length() > 0 && my_isspace(str.at(0))) str.erase(0,1); - while (str.length() > 0 && isspace(str.at(str.length()-1))) + while (str.length() > 0 && my_isspace(str.at(str.length()-1))) str.erase(str.length()-1,1); return str; } @@ -90,6 +104,34 @@ return retval; } + + string str_toupper(string str) + { + for (unsigned i=0; i