string str = ''ac, ef,11,foj, ki"
string tempstring;
while(1)
{
int pos = str.find(',');
if(pos==0)
{
str = str.substr(1);
continue;
}
if(pos<0)
{
vsubstring.push_back(str);
break;
}
tempstring = str.substr(0,pos);
str = str.substr(pos+1);
vsubstring.push_back(tempstring);
}
以上代码可以讲字符串str按逗号 分割为以下字符串:
ac
ef
11
foj
ki