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:@"??????"]
The US 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:"."];
尝试“ en-US”?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.