//对传入的字符串进行解析分割
vector<std::string> schoolBusLayer::httpGetDateSplit(std::string str,std::string separator )
{
vector<string> result;
string::size_type cutAt =0;
int times = 1;
int lastAt = 0;
while( (cutAt = str.find_first_of(separator,times))!=str.npos )
{
if(cutAt > 0)
{
result.push_back(str.substr(0, cutAt));
}
str = str.substr(cutAt + 3);
}
if(str.length() > 0)
{
result.push_back(str);
}
return result;
}
用法:std::vector<string> vec_str_num; vec_str_num= httpGetDateSplit(bufferSchool,"101");