First page Back Continue Last page Graphics

SPLIT

  • vector<string> split(const string & s)
  • {
  • vector<string> ret;
  • typedef string::size_type string_size;
  • string_size i = 0;
  • while(i != s.size( ) ) {
  • // ignore leading blanks
  • while ( i != s.size( ) && isspace ( s[i] ) ) ++i;
  • // find end of next word
  • string_size j = i;
  • while ( j != s.size( ) && !isspace( s[j] ) ) ++j;