Hey guys, i been trying to tokenize a string using the boost library.
1 2 3 4 5 6 7 8
int main(){
usingnamespace std;
usingnamespace boost;
string s = "This is, a test";
tokenizer<> tok(s);
for(tokenizer<>::iterator beg=tok.begin(); beg!=tok.end();++beg){
cout << *beg << "\n";
}
The problem i am facing currently is that i am unable to tokenize a string, yet allow it to leave the whitespaces as token also. I tried replacing the whitespaces with a character , but how am i able to tokenize the string. For example , i subtituted all the white spaces with "|" , thus the string above will be "This|is,||a test".
From here , how can i go about making sure that the string will continue being tokenized only leaving the words , but "|" will not be considered as a char to be removed. Hope for some help here.