Advertisement
Guest User

Untitled

a guest
Apr 28th, 2015
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. static void splitStringToVector ( std::string input, std::vector<std::string> &output, std::string delimiter ) {
  2. size_t pos = 0;
  3. std::string token;
  4. while ( ( pos = input.find ( delimiter ) ) != std::string::npos ) {
  5. token = input.substr ( 0, pos );
  6. if ( !token.empty ( ) ) {
  7. output.push_back ( token );
  8. }
  9. input.erase ( 0, pos + delimiter.length ( ) );
  10. }
  11. output.push_back ( input );
  12. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement