18 lines
539 B
C++
18 lines
539 B
C++
|
#include "public_def.h"
|
||
|
|
||
|
std::vector<std::string> splitString(const std::string& input, const std::string& delimiter) {
|
||
|
std::vector<std::string> tokens;
|
||
|
size_t pos = 0;
|
||
|
std::string backup = input;
|
||
|
std::string token;
|
||
|
|
||
|
while ((pos = backup.find(delimiter)) != std::string::npos) {
|
||
|
token = backup.substr(0, pos);
|
||
|
tokens.push_back(token);
|
||
|
backup.erase(0, pos + delimiter.length());
|
||
|
}
|
||
|
// Push the remaining part after the last delimiter
|
||
|
tokens.push_back(backup);
|
||
|
|
||
|
return tokens;
|
||
|
}
|