• 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
Re: Unexpected behavior of NSNumberFormatter
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unexpected behavior of NSNumberFormatter


  • Subject: Re: Unexpected behavior of NSNumberFormatter
  • From: Chris Kane <email@hidden>
  • Date: Fri, 28 Dec 2001 13:24:56 -0600

On Thursday, December 27, 2001, at 02:02 PM, Nick M|ller wrote:
I'm fiddling around with NSNumberFormatter and don't get what the
documentation seems to promise.

I allocate a NSNumberFormatter, set him to localized and still get the
separators of the default.

// ----
NSNumberFormatter *fmt = [[NSNumbrFormatter alloc] init];
NSLog([fmt decimalSeparator]); // -> "." OK, this is the US-default
[fmt setLocalizesFormat:YES];
NSLog([fmt decimalSeparator]); // -> "." should be "," for DE
// ----

What's the right formatter for Numbers that responds to local/non-local
settings? I need one that can be modified.

The setLocalizesFormat: method doesn't do what you expect, and hardly does anything, if at all, interesting. Only formatters which come out of .nib files can get correctly localized currently. (Actually, it's "only formatters which are unarchived" get localized, so presumably one could archive a formatter to NSData, and unarchive the data (without dealing with the file system), to get a localized formatter.) Apple has a bug on this.


Chris Kane
Cocoa Frameworks, Apple


  • Follow-Ups:
    • Re: Unexpected behavior of NSNumberFormatter
      • From: Nick Müller <email@hidden>
References: 
 >Unexpected behavior of NSNumberFormatter (From: Nick Müller <email@hidden>)

  • Prev by Date: Input in TextView
  • Next by Date: Re: ObjectAlloc troubles
  • Previous by thread: Unexpected behavior of NSNumberFormatter
  • Next by thread: Re: Unexpected behavior of NSNumberFormatter
  • Index(es):
    • Date
    • Thread