20 #include <utility/exit.hh>
24 #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++);
47 if ( from!=fromend ) {
54 if ( outc > 0 && to[outc-1] ==
' ' ) {
75 temp = str.substr(str.length()-n,len);
98 if ( c >=
'0' && c <=
'9' )
return true;
105 if ( (c >= 9 && c <= 13) || c ==
' ' )
return true;
112 string sp =
" "; sp[0] = sep;
113 return split( sp, str );
122 int i = str.find( sep, j );
125 if ( str.substr(j, i - j ).length() > 0 ) {
126 lst.push_back( str.substr( j, i - j ) );
128 j = i + sep.length();
129 i = str.find( sep, j );
132 int l = str.length() - 1;
133 if ( str.substr( j, l - j + 1 ).length() > 0 ) {
134 lst.push_back( str.substr( j, l - j + 1 ) );
144 std::stringstream stream( str );
145 copy( istream_iterator< std::string >(stream), istream_iterator< std::string >(), back_inserter( lst ) );
196 if ( start < (
int) fields.size() ) {
197 for (
int i = start; i <=
end; i++ ) {
198 if ( i >= (
int) fields.size() )
break;
200 if ( i!=end ) temp+=sep;
204 sprintf( buff,
"%s", temp.c_str() );
std::string simplifyWhiteSpace(const std::string &str)
bool isSpace(const char &c)
c
DEPRECATED convert between the real-valued chi dihedrals and the rotamer well indices.
std::string str(T const &t)
bool isDigit(const char &c)
int contains(const std::string &str, const std::string &c)
utility::vector0< std::string > StringList
StringList split(const char sep, const string &str)
StringList split_WhiteSpace(const string &str)
char * section(const string &str, const char &sep, char *buff, int start, int end)