Skip to content

Instantly share code, notes, and snippets.

@heatblazer
Last active December 8, 2020 17:22
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 heatblazer/26ea03cb56eb74a5ade38935eb9b5e3e to your computer and use it in GitHub Desktop.
Save heatblazer/26ea03cb56eb74a5ade38935eb9b5e3e to your computer and use it in GitHub Desktop.
void split(const char* str, const char* delim, std::vector<std::string>& out)
{
const char* begin = str;
const char* it = strstr(str, delim);
if (it != NULL)
{
std::string data{begin, it};
out.push_back(data);
it++;
split(it, delim, out);
} else {
std::string data{str};
out.push_back(data);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment