Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- std::vector<std::string> splitString(const std::string& input) {
- std::vector<std::string> result;
- std::stringstream ss(input);
- std::string token;
- while (std::getline(ss, token, ' ')) { // split by space
- std::stringstream commaStream(token);
- std::string subToken;
- while (std::getline(commaStream, subToken, ',')) { // split by comma
- if (!subToken.empty()) {
- result.push_back(subToken);
- }
- }
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement