Boost logo

Boost Users :

From: Daniel James (daniel_at_[hidden])
Date: 2005-03-21 15:38:19


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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net