NSString stringByTrimmingCharactersInSet: strangeness
NSString stringByTrimmingCharactersInSet: strangeness
- Subject: NSString stringByTrimmingCharactersInSet: strangeness
- From: Gus Mueller <email@hidden>
- Date: Tue, 1 Jul 2003 16:40:22 -0700
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.