00001
00022 #ifndef UTILSTRING_H
00023 #define UTILSTRING_H
00024 #ifndef VECTOR
00025 #include <vector>
00026 #define VECTOR
00027 #endif
00028 #ifndef STRING
00029 #include <string>
00030 #define STRING
00031 #endif
00032 #include <sstream>
00033
00034 namespace UtilString
00035 {
00036 bool atob(const char* s);
00037 bool atob(const char* s, bool& isvalid);
00038 int cmp_nocase(const std::string& s1, const std::string& s2);
00039 int cmp_wildcard(const std::string& s, const std::string& w);
00040 void MakePrintable(const char* in,
00041 std::string& out);
00042 void StringTok(std::vector<std::string>& ls,
00043 const std::string& str,
00044 const std::string& tok);
00045 bool IsBool(const char* s);
00046 bool IsInt(const char* s);
00047 bool IsFloat(const char* s);
00048
00049 std::string ToLower(const std::string& str);
00050 std::string ToUpper(const std::string& str);
00051
00052 template <class T>
00053 std::string ToString(const T& t, std::ios_base & (*f)(std::ios_base&) = std::dec) {
00054 std::ostringstream oss;
00055 oss << f << t;
00056 return oss.str();
00057 }
00058 }
00059 #endif // UTILSTRING_H