• 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: bug or feature in NSNumberFormatter
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug or feature in NSNumberFormatter


  • Subject: Re: bug or feature in NSNumberFormatter
  • From: Chuck Hill <email@hidden>
  • Date: Thu, 17 Jun 2010 14:24:19 -0700

Hi Michael,

On Jun 17, 2010, at 10:29 AM, Michael Schmiedgen wrote:

Hi list,

I get strange behaviour if and only if formatting the
value of zero. Am I something missing? Or what is the
point here?

-----

NSNumberFormatter nf = new NSNumberFormatter("__0.00");

nf.setLocalizesPattern(true);
nf.format(new Integer(0)); // formatted number is '0'

nf.setLocalizesPattern(false);
nf.format(new Integer(0)); // formatted number is '  0.00'

-----

The correct behaviour should be '  0.00', or shouldnt it?

I think the correct answer is "that depends".  The JavaDocs say:

Sets whether this NSNumberFormatter's pattern should be localized. When newDefault is true, NSNumberFormatter chooses the appropriate currency symbol, thousands separator, string for zero, and string for NaN based on locale By default, NSNumberFormatters are not localized.

The Locale (see setLocale) determines this string, not the pattern, when the formatter is localized.


I Have tried various Locales, but it behaves strange all
the time.

If it is a bug, is it possible to fix this in ERXNumberFormatter?

Maybe try one of the Java formatters.


-- 
Chuck Hill             Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.    
http://www.global-village.net/products/practical_webobjects







Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: bug or feature in NSNumberFormatter
      • From: Michael Schmiedgen <email@hidden>
References: 
 >bug or feature in NSNumberFormatter (From: Michael Schmiedgen <email@hidden>)

  • Prev by Date: Re: deployment on tomcat
  • Next by Date: Re: File Sharing question
  • Previous by thread: bug or feature in NSNumberFormatter
  • Next by thread: Re: bug or feature in NSNumberFormatter
  • Index(es):
    • Date
    • Thread