vector<string> splitStr(string str, char delimiter){
vector<string> r;
string tmpstr;
while (!str.empty()){
int ind = str.find_first_of(delimiter);
if (ind == -1){
r.push_back(str);
str.clear();
}
else{
r.push_back(str.substr(0, ind));
str = str.substr(ind + 1, str.size() - ind - 1);
}
}
return r;
}
C++ 切割string splite方法的实现
最新推荐文章于 2024-02-02 23:11:09 发布