21 Mar
2005
21 Mar
'05
8:38 p.m.
Groleo Marius wrote:
hello
int main(){ string str1="\t \nhello world! "; trim_if(str1, is_any_of("\t") ); // str1 == "hello world!" trim_if(str1, is_any_of("\n") ); // str1 == "hello world!" cout << str1; }
I get the following output: #>
hello world! #>
Isn't it supposed to be: #> hello world! #>
???
It's a bit hard to tell what you're expecting, but the following succeeds: string str1="\t \nhello world! "; trim_if(str1, is_any_of("\t") ); trim_if(str1, is_any_of("\n") ); assert(str1 == " \nhello world! "); which is what I'd expect. Daniel