00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef STRING_UTILS_H
00016 #define STRING_UTILS_H
00017
00018 #include "pandabase.h"
00019
00020 #include <string>
00021 #include "vector_string.h"
00022
00023
00024
00025 EXPCL_PANDA_PUTIL int cmp_nocase(const string &s, const string &s2);
00026
00027
00028 EXPCL_PANDA_PUTIL int cmp_nocase_uh(const string &s, const string &s2);
00029
00030
00031 EXPCL_PANDA_PUTIL string downcase(const string &s);
00032
00033
00034 EXPCL_PANDA_PUTIL string upcase(const string &s);
00035
00036
00037 EXPCL_PANDA_PUTIL int extract_words(const string &str, vector_string &words);
00038 EXPCL_PANDA_PUTIL int extract_words(const wstring &str, pvector<wstring> &words);
00039
00040
00041 EXPCL_PANDA_PUTIL void tokenize(const string &str, vector_string &words,
00042 const string &delimiters,
00043 bool discard_repeated_delimiters = false);
00044 EXPCL_PANDA_PUTIL void tokenize(const wstring &str, pvector<wstring> &words,
00045 const wstring &delimiters,
00046 bool discard_repeated_delimiters = false);
00047
00048
00049 EXPCL_PANDA_PUTIL string trim_left(const string &str);
00050 EXPCL_PANDA_PUTIL wstring trim_left(const wstring &str);
00051 EXPCL_PANDA_PUTIL string trim_right(const string &str);
00052 EXPCL_PANDA_PUTIL wstring trim_right(const wstring &str);
00053 EXPCL_PANDA_PUTIL string trim(const string &str);
00054 EXPCL_PANDA_PUTIL wstring trim(const wstring &str);
00055
00056
00057 EXPCL_PANDA_PUTIL int string_to_int(const string &str, string &tail);
00058 EXPCL_PANDA_PUTIL bool string_to_int(const string &str, int &result);
00059 EXPCL_PANDA_PUTIL double string_to_double(const string &str, string &tail);
00060 EXPCL_PANDA_PUTIL bool string_to_double(const string &str, double &result);
00061 EXPCL_PANDA_PUTIL bool string_to_float(const string &str, PN_stdfloat &result);
00062
00063
00064
00065 template<class Thing>
00066 INLINE string format_string(const Thing &thing);
00067
00068 #include "string_utils.I"
00069
00070 #endif
00071