1 #include "ChapiStringUtilities.h"
5 typedef vector<string>::const_iterator VCI;
7 namespace chapi_string_utilities
10 vector<string> slice(
string A,
string sep)
16 for (u_int i=0; i<N; i++)
18 string comp = A.substr(i,1);
25 if (tmp!=
"") {v.push_back(tmp);}
34 map<string,string> associate_pieces(vector<string> v,
string sep)
39 for (VCI i = b; i!=e; ++i)
41 vector<string> ss = slice(*i,sep);
51 void cut_string_after_sub(
string& input,
const string& sub)
58 I = input.find_last_of(sub);
59 if (I==string::npos)
return;
60 b = input.begin() + I;
65 bool good_character(
char* src)
67 if (strncmp(src,
" ",1)==0)
return false;
68 if (strncmp(src,
"\n",1)==0)
return false;
69 if (strncmp(src,
"\t",1)==0)
return false;
70 if (strncmp(src,
"\r",1)==0)
return false;
74 string filter_string(
char* src)
79 for (
int i=0; i<n; i++)
81 if (good_character(&src[i]))