void split(const std::string& inputStr, const std::string& seperateStr, std::vectorstd::string& ouputVec)
{
std::string::size_type startPos = 0;
std::string::size_type sepPos = inputStr.find(seperateStr, startPos);
while (sepPos != std::string::npos) {
std::string singleStr = inputStr.substr(startPos, sepPos - startPos);
if (singleStr.size() > 0) {
ouputVec.push_back(singleStr);
}
startPos = sepPos + seperateStr.size();
sepPos = inputStr.find(seperateStr, startPos);
}
if (startPos + seperateStr.size() < inputStr.size() - 1) {
std::string singleStr = inputStr.substr(startPos, inputStr.size() - 1);
ouputVec.push_back(singleStr);
}
}
weixin_42491321 发布了1 篇原创文章 · 获赞 0 · 访问量 12 私信 关注