Skip to content

Instantly share code, notes, and snippets.

@rep-movsd
Last active May 16, 2016 19:58
Show Gist options
  • Save rep-movsd/d5befa9c9caa399ac2d296b06cd76bae to your computer and use it in GitHub Desktop.
Save rep-movsd/d5befa9c9caa399ac2d296b06cd76bae to your computer and use it in GitHub Desktop.
Compact split()
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