Re: NSFormatter troubles (was: NSScanner troubles)
Re: NSFormatter troubles (was: NSScanner troubles)
- Subject: Re: NSFormatter troubles (was: NSScanner troubles)
- From: "Stephen J. Butler" <email@hidden>
- Date: Sat, 11 Dec 2010 18:25:32 -0600
On Sat, Dec 11, 2010 at 5:58 PM, WT <email@hidden> wrote:
> [wrt NSNumberFormatter] However, setUsesGroupingSeparator:YES still has no effect for me.
>
> May I send you (off-list) the test project?
For those following along at home, this happens to be an iOS project.
I did this and it seems to work for me:
- (NSNumberFormatter*) numberFormatter
{
if (numberFormatter_ == nil)
{
numberFormatter_ = [[NSNumberFormatter alloc] init];
[numberFormatter_ setLocale: self.localePtBr];
[numberFormatter_ setUsesGroupingSeparator: YES];
[numberFormatter_ setNumberStyle:NSNumberFormatterDecimalStyle];
}
return numberFormatter_;
}
Looks like on iOS the setNumberStyle: call is required to get it to
properly handle the grouping separator, while on OS X it isn't.
(note: you've got a lot of extra ';' after your method implementations
that the compiler ignores.. but should probably be cleaned up)
_______________________________________________
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