diff options
| author | Paul Buetow <paul@buetow.org> | 2013-04-06 13:14:43 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2013-04-06 13:14:43 +0200 |
| commit | 796609174e5ecb35fab992969e7690186840048a (patch) | |
| tree | 1e4370d47f2a5c050b768c228e73e028a6611cb8 /src/tool | |
| parent | 312fe18cb5f97143f3600b207e979bc559256b6f (diff) | |
tagging ychat-0.7.3ychat-0.7.3
Diffstat (limited to 'src/tool')
| -rw-r--r-- | src/tool/tool.cpp | 16 | ||||
| -rw-r--r-- | src/tool/tool.h | 12 |
2 files changed, 24 insertions, 4 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 ) { diff --git a/src/tool/tool.h b/src/tool/tool.h index a350c69..7352772 100644 --- a/src/tool/tool.h +++ b/src/tool/tool.h @@ -3,16 +3,19 @@ #include "../incl.h" +#include <list> + using namespace std; class tool { public: + static list<string> split_string(string s_string, string s_split); + static bool is_alpha_numeric( string &s_digit ) { - auto const char *digit = s_digit.c_str(); - auto int i_len = strlen( digit ); - + const char *digit = s_digit.c_str(); + int i_len = strlen( digit ); for( int i=0; i<i_len; i++ ) { @@ -27,6 +30,7 @@ public: static char* clean_char( char* c_str); static string trim( string s_str ); static string replace( string s_string, string s_search, string s_replace ); + static string int2string( int i_int ) { char buffer[64]; @@ -84,7 +88,7 @@ public: static string shell_command( string s_command, method m_method ); - static string yhttpd_version() + static string ychat_version() { return string(VERSION) + "-" + string(BRANCH) + " Build " + int2string(BUILDNR); } |
