Skip to content

Instantly share code, notes, and snippets.

@jassinm
Created January 7, 2013 21:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jassinm/4478841 to your computer and use it in GitHub Desktop.
Save jassinm/4478841 to your computer and use it in GitHub Desktop.
std::vector<std::string> split(const std::string &s, const std::string &tosplit){
const std::regex rsplit(tosplit + "+");
auto rit = std::sregex_token_iterator(s.begin(), s.end(), rsplit, -1);
auto rend = std::sregex_token_iterator();
auto res = std::vector<std::string>(rit, rend);
return res;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment