std::vector<std::string> split(const std::string &str, const std::string &pattern)
{
std::vector<std::string> resVec;
//方便截取最后一段数据
std::string strs = str + pattern;
size_t pos = strs.find(pattern);
size_t size = strs.size();
size_t count = pattern.size();
while (pos != std::string::npos)
{
std::string x = strs.substr(0, pos);
resVec.push_back(x);
strs = strs.substr(pos + count, size); // size 超出范围会自动到源的最后
pos = strs.find(pattern);
}
return resVec;
}