Created
February 23, 2016 10:53
-
-
Save yumetodo/4059d985e627512a229d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
std::vector<std::string> split(const std::string &str, char delim) { | |
std::vector<std::string> res; | |
std::size_t current = 0, found; | |
while ((found = str.find_first_of(delim, current)) != std::string::npos) { | |
res.emplace_back(str, current, found - current); | |
current = found + 1; | |
} | |
res.emplace_back(str, current, str.size() - current); | |
return res; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment