>> 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.
Ok, behaviour is within the spec ('string for zero'). But treating zero not like any other number makes no sense to me. I will implement a subclass of NSNumberFormatter that formats zero like any other number. Thanks Michael -- Michael Schmiedgen, BSc Takwa GmbH Friedrich-List-Str. 36 99096 Erfurt GERMANY Tel +49 361 6534096 Fax +49 361 6534097 Mail schmied...@takwa.de Web http://www.takwa.de/ Geschaeftsfuehrung: Ingo Buchholz HRB 112964, Amtsgericht Jena _______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com