Re: NSFormatter troubles (was: NSScanner troubles)
Re: NSFormatter troubles (was: NSScanner troubles)
- Subject: Re: NSFormatter troubles (was: NSScanner troubles)
- From: WT <email@hidden>
- Date: Sat, 11 Dec 2010 22:36:45 -0200
On Dec 11, 2010, at 10:25 PM, Stephen J. Butler wrote:
> 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_;
> }
Yes, setting the number style works for me too though, again, it strikes me odd that one should have to set a style for reading data when we can't be sure that the data will be in that particular style.
> 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.
Apparently so.
> (note: you've got a lot of extra ';' after your method implementations
> that the compiler ignores.. but should probably be cleaned up)
I may be wrong, but I seem to recall that method definitions are allowed to end in ';'. I made it a habit to add the terminating semi-colon because it makes it easy to copy and paste the method declarations to/from the header and implementation files.
Thanks again for all your help. It's much appreciated.
WT_______________________________________________
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