fs_*_*gre 1 number-formatting ios swift
我有一个应用程序,我正在尝试格式化Double
,NumberFormetter
但我得到的输出与其他应用程序中的输出不匹配.
这是我正在使用的代码......
let price:Double = 25
let currencyFormatter = NumberFormatter()
currencyFormatter.usesGroupingSeparator = true
currencyFormatter.numberStyle = .currency
currencyFormatter.locale = NSLocale.current
let priceFormatter = currencyFormatter.string(for: price)
myLabel.text = priceFormatter
Run Code Online (Sandbox Code Playgroud)
使用上面的代码,并且Region
在我的应用程序中将手机设置为中国,我得到的25,00 CNY
是另外两个第三方应用程序的输出CN¥25.00
.
我究竟做错了什么?
我的应用程序
25,00 CNY其他应用程序
¥25.00
我的应用程序
25,00€其他应用程序
€25,00
但是当该区域设置为United States
我在所有三(3)个应用程序中得到相同的表示法.
我的应用程序
$ 25.00其他应用
$ 25.00
我有点担心尤其是当区域设置为中国的输出,因为除了符号是不同的我也得到了不同的符号CNY
VS CN¥
.
有什么建议,我做错了吗?
归档时间: |
|
查看次数: |
625 次 |
最近记录: |