From 796609174e5ecb35fab992969e7690186840048a Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 6 Apr 2013 13:14:43 +0200 Subject: tagging ychat-0.7.3 --- src/tool/tool.cpp | 16 ++++++++++++++++ src/tool/tool.h | 12 ++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) (limited to 'src/tool') 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 +tool::split_string(string s_string, string s_split) { + list 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 + using namespace std; class tool { public: + static list 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