views:

220

answers:

2

In particular I want to guarantee that the formatting of a number uses , (commmas) for separating digits regardless of the current locale of the device.

NSNumberFormatter *numFormatter = [[NSNumberFormatter alloc] init];
[numFormatter setLocal:@"??????"]
A: 

Tried "en-US" ?

Mihai Nita
+1  A: 

The U.S. uses a period as a decimal separator. I assume you mean that you want to use a comma as a grouping separator.

You don't need to set the locale for this in your NSNumberFormatter, you can set both directly using code like the following:

[numFormatter setGroupingSeparator:","];
[numFormatter setUsesGroupingSeparator:YES];
[numFormatter setDecimalSeparator:"."];
Brad Larson