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! #> ??? -- Regards, Groleo! .''`. # touch universe : :' : # chmod +rwx universe `. `'` # ./universe `- Debian - when you have better things to do than fix a system
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
participants (2)
-
Daniel James
-
Groleo Marius