diff options
Diffstat (limited to 'src/tool/tool.cpp')
| -rw-r--r-- | src/tool/tool.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/tool/tool.cpp b/src/tool/tool.cpp index 1da4a12..e2ef9ae 100644 --- a/src/tool/tool.cpp +++ b/src/tool/tool.cpp @@ -11,6 +11,22 @@ #include "tool.h" +list<string> +tool::split_string(string s_string, string s_split) { + list<string> list_ret; + unsigned i_pos, i_len = s_split.length(); + + while ( (i_pos = s_string.find(s_split)) != string::npos ) + { + list_ret.push_back( s_string.substr(0, i_pos) ); + s_string = s_string.substr( i_pos + i_len ); + } + + list_ret.push_back( s_string ); + + return list_ret; +} + string tool::trim( string s_str ) { |
