Last active
May 16, 2016 20:06
-
-
Save rep-movsd/53427e6ed83925f656a949f802e145cf to your computer and use it in GitHub Desktop.
Generic splitter
This file contains hidden or 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
vector<string> split(const string& s, string seps=" ") | |
{ | |
vector<string> ret; | |
for(auto ps = &s[0], pd = ps, pe = ps + int(s.size()); ps < pe; ps = pd + 1) | |
{ | |
ret.emplace_back(string(ps, pd = find_first_of(ps, pe, begin(seps), end(seps)))); | |
} | |
return ret; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment