No, there is no way to configure it for this.
In "10.4 mode", NSNumberFormatter basically just wraps CFNumberFormatter (although it is not a direct paid shell). You can see the list of Formatterter property keys and itβs pretty clear that there is nothing that will do what you want. (Perhaps this is possible in "10.0" mode, it will take a little trial and error to find out. But I doubt that you want to use this.)
So pre-rounding (as Justin Boo suggests) is probably your best bet.
You could, of course, post-process instead. Exactly what you want to do may depend on whether you also want to display -0.00 as 0.00, what you want to do for localizations that do not use "-0", etc. The simplest case will be as simple as this: / p>
@interface NSNumberFormatter (NegativeZero) - (NSString *)stringFromNumberNoNegativeZero:(NSNumber *)number; @end @implementation NSNumberFormatter (NegativeZero) - (NSString *)stringFromNumberNoNegativeZero:(NSNumber *)number { NSString *s = [self stringFromNumber:number]; if ([s isEqualToString:@"-0"]) return @"0"; return s; } @end
But if you need something more complex, it will get complicated.
source share