删除字符串中的空白字符

2 views
Skip to first unread message

bruc...@gmail.com

unread,
Oct 18, 2005, 9:10:37 PM10/18/05
to 星星爱CPP
删除字符串中的空格
str.erase( remove_if( str.begin(), str.end(),
bind1st(equal_to<char>(),' ') ), str.end() );

删除字符串中的White-Space Characters(Space, tab, linefeed,
carriage-return, formfeed, vertical-tab, and newline):
str.erase( remove_if( str.begin(), str.end(), isspace ), str.end() );

Reply all
Reply to author
Forward
0 new messages