Skip to content

Instantly share code, notes, and snippets.

@enumag
Created January 2, 2012 11:32
Show Gist options
  • Select an option

  • Save enumag/1550359 to your computer and use it in GitHub Desktop.

Select an option

Save enumag/1550359 to your computer and use it in GitHub Desktop.
C++ explode
std::vector<std::string> explode(std::string str, char delim = ' ') {
std::vector<std::string> result;
std::stringstream stream(str);
std::string buffer = "";
while (std::getline(stream, buffer, delim)) {
result.push_back(buffer);
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment