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 );
}
Created
September 4, 2018 01:06
-
-
Save codeRhythm/fcd91cf9f4001316446b01763524d4d7 to your computer and use it in GitHub Desktop.
remove-in-c++
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment