[英]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.