
int splitString(const string& str, vector<string>& strList, const string& delimiter)
{
string::size_type lastPos = str.find_first_not_of(delimiter, 0);
string::size_type pos = str.find_first_of(delimiter, lastPos);
while((string::npos != pos) || (string::npos != lastPos))
{
strList.push_back(str.substr(lastPos, pos - lastPos));
lastPos = str.find_first_not_of(delimiter, pos);
pos = str.find_first_of(delimiter, lastPos);
}
return strList.size();
}




中级程序员
by: 子清 发表于:2020-03-08 16:35:13 顶(1) | 踩(1) 回复
用什么版 本打开好?
回复评论