string s = "\r\n\t \t这是随便写的一句话。\t\t " ;
size_t n = s.find_last_not_of( " \r\n\t" );
if ( n != string::npos )
{ s.erase( n + 1 , s.size() - n );
} n = s.find_first_not_of ( " \r\n\t" );
if ( n != string::npos )
{ s.erase( 0 , n );
} |
给大家推荐一个站点:http://*.com/