Guest User

Untitled

a guest
Jan 22nd, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. void StringSplit(std::string str, std::string delim, std::vector<std::string> results)
  2. {
  3.     int cutAt;
  4.  
  5.     while( (cutAt = str.find_first_of(delim)) != str.npos )
  6.     {
  7.         if(cutAt > 0)
  8.         {
  9.             results.push_back(str.substr(0,cutAt));
  10.         }
  11.         str = str.substr(cutAt+1);
  12.     }
  13.  
  14.     if(str.length() > 0)
  15.     {
  16.         results.push_back(str);
  17.     }
  18. }
Add Comment
Please, Sign In to add comment