• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Strange NSNumberFormatter behavior
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Strange NSNumberFormatter behavior


  • Subject: Strange NSNumberFormatter behavior
  • From: Karolis Ramanauskas <email@hidden>
  • Date: Tue, 10 Nov 2009 21:18:25 -0600

Good evening,

My question involves the code below:

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

[nf setNumberStyle:NSNumberFormatterSpellOutStyle];

 NSLog(@"'%@'", [nf numberFromString:@"one"]);     // <- LINE A

NSLog(@"'%@'", [nf numberFromString:@"one two"]); // <- LINE B


On OSX10.6, line A will generate '1', however line B will generate 'nil'.
This is the behavior on which my method relies. However, the same code on
iPhone (or at least iPhone Simulator 3.1) generates '1' in both cases, this
causes my method to behave differently on these platforms. I was trying
different NSNumberFormatter properties to achieve the same behavior with no
avail.

I've also tried getObjectValue:forString:range:error method and it has the
same behavior.

Any help is appreciated.

Thanks
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Prev by Date: Re: questions on memory issues
  • Next by Date: NSArrayController question
  • Previous by thread: Transient Property and lazy-loading issue
  • Next by thread: NSArrayController question
  • Index(es):
    • Date
    • Thread