00001
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 #ifndef StringUtil_h
00051 #define StringUtil_h
00052
00053 #include <string>
00054 #include <vector>
00055 #include <sstream>
00056
00079 bool isEscaped(const std::string& str, std::string::size_type pos);
00080
00081
00106 std::string escape(const std::string str);
00107
00108
00135 std::string unescape(const std::string str);
00136
00137
00145 void eraseHeadBlank(std::string& str);
00146
00147
00155 void eraseTailBlank(std::string& str);
00156
00157
00165 void replaceString(std::string& str, const std::string from,
00166 const std::string to);
00167
00168
00176 std::vector<std::string> split(const std::string& input,
00177 const std::string& delimiter);
00178
00179
00187 bool toBool(std::string str, std::string yes, std::string no,
00188 bool default_value = true);
00189
00190
00198 bool isAbsolutePath(const std::string& str);
00199
00200
00208 bool isURL(const std::string& str);
00209
00210
00218 template <class Printable>
00219 std::string otos(Printable n)
00220 {
00221 std::stringstream str_stream;
00222 str_stream << n;
00223 return str_stream.str();
00224 };
00225
00226 std::vector<std::string> unique_sv(std::vector<std::string> sv);
00227
00228 std::string flatten(std::vector<std::string> sv);
00229
00230 #endif // StringUtil_h