[英]On the iPhone, what would be the locale identifier for forcing US english representations of numbers?
特别是,我想保证数字的格式使用,(逗号)分隔数字,而与设备的当前语言环境无关。
NSNumberFormatter *numFormatter = [[NSNumberFormatter alloc] init];
[numFormatter setLocal:@"??????"]
美国使用句点作为小数点分隔符。 我假设您的意思是您要使用逗号作为分组分隔符。
您无需在NSNumberFormatter中为此设置语言环境,可以直接使用如下代码设置两者:
[numFormatter setGroupingSeparator:","];
[numFormatter setUsesGroupingSeparator:YES];
[numFormatter setDecimalSeparator:"."];
尝试“ en-US”?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.