Hello there,

Thought I'll share a little observation I just made, and that cost me about
an hour to debug. This is in hope that, using my experience, you may check
for similar bugs.

Look at this piece of code:

///

 NSNumberFormatter * nf = [[[NSNumberFormatter alloc] init] autorelease];

 [nf setNumberStyle:NSNumberFormatterSpellOutStyle];

 NSNumber * result = [nf numberFromString:@" five"];

 NSLog(@"result: %@", result);

 ///

If you were to run it in 10.6, no problem, it will return 5. However on the
iPhone (or, at least, on the simulator) you'll get a beautiful (null). The
problem seems to be the space in the string in front of 'five'. Apparently
OSX implementation of NSNumberFormatter trims the string while iPhone
implementation doesn't. I noticed this because I have a project with two
targets, one for iPhone and one for OSX. My application kept returning
different results while using the same source until I found this tidbit. So
I trimmed whitespace and it's all great.

Also, are there other similar inconsistencies I should be aware of that any
of you know of?

Peace,
Thanks
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to