Skip to content

Instantly share code, notes, and snippets.

@boo1ean
Created June 1, 2013 20:42
Show Gist options
  • Save boo1ean/5691668 to your computer and use it in GitHub Desktop.
Save boo1ean/5691668 to your computer and use it in GitHub Desktop.
vector<string> &split(const string &s, char delim, vector<string> &elems) {
stringstream ss(s);
string item;
while (getline(ss, item, delim)) {
elems.push_back(item);
}
return elems;
}
vector<string> split(const string &s, char delim) {
vector<string> elems;
split(s, delim, elems);
return elems;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment