Last active
May 16, 2016 19:58
-
-
Save rep-movsd/d5befa9c9caa399ac2d296b06cd76bae to your computer and use it in GitHub Desktop.
Compact split()
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
vstr split(cstref s, st seps=" ") | |
{ | |
vstr ret; | |
for(auto ps = pbeg(s), pd = ps, pe = ps + sz(s); ps < pe; ps = pd + 1) | |
ret.eb(st(ps, pd = find_first_of(ps, pe, all(seps)))); | |
return ret; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment