Json_STL完善

This commit is contained in:
2022-04-23 00:49:13 +08:00
parent 44ea52a10a
commit 4b711b004b
4 changed files with 128 additions and 22 deletions

View File

@@ -346,4 +346,28 @@ const wchar_t* DNFTOOL::GetWC(const char* c)
mbstowcs(wc, c, cSize);
return wc;
}
}
void DNFTOOL::Split(const std::string& src, std::vector<std::string>& dest, const std::string& separator)
{
std::string str = src;
std::string substring;
std::string::size_type start = 0, index;
dest.clear();
index = str.find_first_of(separator, start);
do
{
if (index != std::string::npos)
{
substring = str.substr(start, index - start);
dest.push_back(substring);
start = index + separator.size();
index = str.find(separator, start);
if (start == std::string::npos) break;
}
} while (index != std::string::npos);
//the last part
substring = str.substr(start);
dest.push_back(substring);
}