c++ split ()

c++ code:
Split(const string& s, const string& delimiter, vector<string>* result)
{
  size_t last = 0;
  size_t index = s.find_first_of(delimiter, last);
  while (index != string::npos)
  {
    result->push_back(s.substr(last, index - last));
    last = index + 1;
    index = s.find_first_of(delimiter, last);
  }
  if (index - last > 0)
  {
    result->push_back(s.substr(last, index - last));
  }
}

你可能感兴趣的:(C++,c,String)