UtilString.hxx
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
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
00035 namespace UtilString
00036 {
00037 bool atob(const char* s);
00038 bool atob(const char* s, bool& isvalid);
00039 int cmp_nocase(const std::string& s1, const std::string& s2);
00040 int cmp_wildcard(const std::string& s, const std::string& w);
00041 void MakePrintable(const char* in,
00042 std::string& out);
00043 void StringTok(std::vector<std::string>& ls,
00044 const std::string& str,
00045 const std::string& tok);
00046 bool IsBool(const char* s);
00047 bool IsInt(const char* s);
00048 bool IsFloat(const char* s);
00049
00050 std::string ToLower(const std::string& str);
00051 std::string ToUpper(const std::string& str);
00052
00053 template <class T>
00054 std::string ToString(const T& t, std::ios_base & (*f)(std::ios_base&) = std::dec) {
00055 std::ostringstream oss;
00056 oss << f << t;
00057 return oss.str();
00058 }
00059 }
00060
00061 #endif // UTILSTRING_H
00062