Skip to content

Instantly share code, notes, and snippets.

@seanwu1105
Created March 14, 2018 15:12
Show Gist options
  • Save seanwu1105/f8d81e998e273c360203b94300117a73 to your computer and use it in GitHub Desktop.
Save seanwu1105/f8d81e998e273c360203b94300117a73 to your computer and use it in GitHub Desktop.
Split the string line by normal delimiters. Returns a vector containing all words in it.
std::vector<std::string> SplitLine(const std::string &line)
{
std::vector<std::string> tokens;
std::stringstream ss(line);
copy(std::istream_iterator<std::string>(ss),
std::istream_iterator<std::string>(),
back_inserter(tokens));
return tokens;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment