third_party/libprocess/include/stout/strings.hpp
// Splits the string using the provided delimiters.
// Empty tokens are allowed in the result.
Splits the string using the provided delimiters.
Empty tokens are allowed in the result.
Splits the string using the provided delimiters . Empty tokens are allowed in the result .
inline std::vector<std::string> split(
    const std::string& s,
    const std::string& delims)
{
  std::vector<std::string> tokens;
  size_t offset = 0;
  size_t next = 0;
  while (true) {
    next = s.find_first_of(delims, offset);
    if (next == std::string::npos) {
      tokens.push_back(s.substr(offset));
      break;
    }
    tokens.push_back(s.substr(offset, next - offset));
    offset = next + 1;
  }
  return tokens;
}
inline std :: vector < std :: string > split ( const std :: string & s , const std :: string & delims ) { std :: vector < std :: string > tokens ; size_t offset = 0 ; size_t next = 0 ; while ( true ) { next = s . find_first_of ( delims , offset ) ; if ( next == std :: string :: npos ) { tokens . push_back ( s . substr ( offset ) ) ; break ; } tokens . push_back ( s . substr ( offset , next - offset ) ) ; offset = next + 1 ; } return tokens ; }
Splits the string using the provided delimiters.
Splits the string using the provided delimiters .