Masterchoc

Untitled

Jun 17th, 2019
119
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. static inline std::vector<std::string> splitString(const std::string& str, const std::string& delimiter)
  2. {
  3.     std::vector<std::string> strings;
  4.     std::string::size_type pos = 0;
  5.     std::string::size_type prev = 0;
  6.  
  7.     while ((pos = str.find(delimiter, prev)) != std::string::npos)
  8.     {
  9.         strings.push_back(str.substr(prev, pos - prev));
  10.         prev = pos + 1;
  11.     }
  12.  
  13.     strings.push_back(str.substr(prev));
  14.  
  15.     return strings;
  16. }
RAW Paste Data