Skip to content

Instantly share code, notes, and snippets.

@sailfish009
Created March 14, 2019 00:50
Show Gist options
  • Save sailfish009/a2537844d84db83602cd68ef7a3cb0b1 to your computer and use it in GitHub Desktop.
Save sailfish009/a2537844d84db83602cd68ef7a3cb0b1 to your computer and use it in GitHub Desktop.
#include <sstream>
#include <string>
std::vector<std::string> split(const std::string& s, char delimiter)
{
std::vector<std::string> tokens;
std::string token;
std::istringstream tokenStream(s);
while (std::getline(tokenStream, token, delimiter))
{
tokens.push_back(token);
}
return tokens;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment