Possible Duplicate:
How to split a string?
I have a string like this.
a1,b1,a2,b2......
I want a vector of strings like this
a[0] = "a1"
a[1] = "b1"
a[2] = "a2"
a[3] = "b2"
please help me!!
I am not a good programmer, is for a homework, and i only finds this
string sentence = "Something,in,the,way,she,moves...";
istringstream iss(sentence);
copy(istream_iterator<string>(iss),
istream_iterator<string>(),
ostream_iterator<string>(cout, "\n"));
vector<string> tokens;
copy(istream_iterator<string>(iss),
istream_iterator<string>(),
back_inserter<vector<string> >(tokens));
but this only split the words separated by whitespaces.