third_party/libprocess/include/stout/strings.hpp
// Tokenizes the string using the delimiters.
// Empty tokens will not be included in the result.
Tokenizes the string using the delimiters.
Empty tokens will not be included in the result.
Tokenizes the string using the delimiters . Empty tokens will not be included in the result .
inline std::vector<std::string> tokenize(
    const std::string& s,
    const std::string& delims)
{
  size_t offset = 0;
  std::vector<std::string> tokens;
  while (true) {
    size_t i = s.find_first_not_of(delims, offset);
    if (std::string::npos == i) {
      offset = s.length();
      return tokens;
    }
    size_t j = s.find_first_of(delims, i);
    if (std::string::npos == j) {
      tokens.push_back(s.substr(i));
      offset = s.length();
      continue;
    }
    tokens.push_back(s.substr(i, j - i));
    offset = j;
  }
  return tokens;
}
inline std :: vector < std :: string > tokenize ( const std :: string & s , const std :: string & delims ) { size_t offset = 0 ; std :: vector < std :: string > tokens ; while ( true ) { size_t i = s . find_first_not_of ( delims , offset ) ; if ( std :: string :: npos == i ) { offset = s . length ( ) ; return tokens ; } size_t j = s . find_first_of ( delims , i ) ; if ( std :: string :: npos == j ) { tokens . push_back ( s . substr ( i ) ) ; offset = s . length ( ) ; continue ; } tokens . push_back ( s . substr ( i , j - i ) ) ; offset = j ; } return tokens ; }
Tokenizes the string using the delimiters.
Tokenizes the string using the delimiters .