Re: NSString stringByTrimmingCharactersInSet: strangeness
Re: NSString stringByTrimmingCharactersInSet: strangeness
- Subject: Re: NSString stringByTrimmingCharactersInSet: strangeness
- From: Gus Mueller <email@hidden>
- Date: Wed, 2 Jul 2003 13:46:43 -0700
I ended up getting the answer from Dustin Voss- Thanks Dustin!
Anyway, it's a known bug and there is a tech article up about it at:
http://developer.apple.com/qa/qa2001/qa1202.html
thanks,
-gus
Gus Mueller (email@hidden) wrote:
>
I just noticed something that I thought was odd about the
>
stringByTrimmingCharactersInSet method in NSString-
>
>
I've got the following code (sorry for the formatting):
>
>
int main (int argc, const char * argv[]) {
>
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
>
NSLog(@"trimed is: '%@'",
>
[@"s" stringByTrimmingCharactersInSet:
>
[NSCharacterSet whitespaceCharacterSet]]
>
);
>
[pool release];
>
return 0;
>
}
>
>
and it gives me the output:
>
>
2003-07-01 18:35:31.816 strtest[9480] trimed is: ''
>
>
... that seems a little weird- I figured it would just return the "s"
>
again, not an empty string.. I read the docs on
>
stringByTrimmingCharactersInSet and it suggests that what I'm thinking
>
is correct, but the output isn't. If I use the string "ss", everything
>
works fine, but a variation in the single s (" s") isn't.
>
>
Can anybody shed some light on this? Do I misunderstand this api?
>
>
thanks,
>
>
-gus
>
>
--
>
"Christmas means carnage!" -- Ferdinand, the duck
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
-gus
--
"Christmas means carnage!" -- Ferdinand, the duck
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.