标签:
void split(const std::string& src, const std::string& sq, StringVec& dstVec)
{
dstVec.clear();
std::string::size_type pos = 0;
std::string::size_type pre = 0;
for(;pos < src.size();pre = pos + sq.size())
{
pos = src.find(sq, pre);
dstVec.push_back(src.substr(pre, pos - pre)
}
if(src.empty())
{
dstVec.push_back(src);
}
}
标签:
原文地址:http://www.cnblogs.com/streams/p/5769592.html