21 #include <utility/exit.hh>
25 #include <utility/vector0.hh>
38 runtime_assert( 20000 > str.size() );
39 const char *from = str.c_str();
40 const char *fromend = from+str.length();
45 while( from!=fromend &&
isSpace(*from) ) from++;
46 while( from!=fromend && !
isSpace(*from) ) to[outc++] = *(from++);
53 if ( outc > 0 && to[outc-1] ==
' ' )
72 temp = str.substr(str.length()-n,len);
94 if( c >=
'0' && c <=
'9')
return true;
101 if( (c >= 9 && c <= 13) || c ==
' ' )
return true;
108 string sp =
" "; sp[0] = sep;
109 return split( sp, str );
118 int i = str.find( sep, j );
121 if ( str.substr(j, i - j ).length() > 0 )
122 lst.push_back( str.substr( j, i - j ) );
123 j = i + sep.length();
124 i = str.find( sep, j );
127 int l = str.length() - 1;
128 if ( str.substr( j, l - j + 1 ).length() > 0 )
129 lst.push_back( str.substr( j, l - j + 1 ) );
138 std::stringstream stream( str );
139 copy( istream_iterator< std::string >(stream), istream_iterator< std::string >(), back_inserter( lst ) );
190 if( start < (
int) fields.size() )
191 for(
int i = start; i <=
end; i++) {
192 if( i >= (
int) fields.size())
break;
194 if(i!=end) temp+=sep;
197 sprintf( buff,
"%s", temp.c_str() );