Molecular Dynamics Simulation  1.0
Functions
StringUtils.cpp File Reference
#include "StringUtils.h"
Include dependency graph for StringUtils.cpp:

Go to the source code of this file.

Functions

std::vector< std::string > split (const std::string &s, const std::string &delimiter)
 

Function Documentation

◆ split()

std::vector<std::string> split ( const std::string &  s,
const std::string &  delimiter 
)

Definition at line 3 of file StringUtils.cpp.

3  {
4  std::vector<std::string> tokens;
5 
6  size_t start = 0;
7  size_t end = s.find(delimiter);
8 
9  while (end != std::string::npos) {
10  tokens.push_back(s.substr(start, end - start));
11  start = end + delimiter.size();
12  end = s.find(delimiter, start);
13  }
14 
15  tokens.push_back(s.substr(start, end));
16 
17  return tokens;
18 }