I tried this code which can split the string by comma:
string spa ="12,233,434,2";
istringstream iss(spa + ",");
int val;
char dot =',';
while(iss >> val >> dot){
cout << val << endl;
}
But I have no idea how it works. It seems to extract the value firstly, then right-shifts?