Json_STL完善
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user