标签:
由于太久远了,已经忘记作者是谁了,如果看到了,真的对不起,希望能给我留个言(我的QQ:543451622)
void split(const string& src, const string& separator, vector<string>& dest) { string str = src; string substring; string::size_type start = 0, index; do { index = str.find_first_of(separator,start); if (index != string::npos) { substring = str.substr(start,index-start); dest.push_back(substring); start = str.find_first_not_of(separator,index); if (start == string::npos) return; } }while(index != string::npos); //the last token substring = str.substr(start); dest.push_back(substring); }
标签:
原文地址:http://www.cnblogs.com/chdxiaoming/p/4381333.html