inline bool SplitStr(string str, char splitCh, vector<string>& result){
size_t npos = str.find_first_of(splitCh);
while (npos != string::npos){
string substr = str.substr(0, npos);
if (substr.length() > 0){
result.push_back(substr);
}
str = str.substr(npos + 1);
npos = str.find_first_of(splitCh);
}
if (str.length() > 0){
result.push_back(str.substr(0, npos));
}
return result.size() > 0;
}
分割字符串
最新推荐文章于 2023-03-02 15:33:44 发布