Post

Replies

Boosts

Views

Activity

NSNumberFormatter.format produces strange output
Hello everebody!I have some problem with NSNumberFormatter,unicode formats and locale.I have:public func build(locale: Locale?) -> NumberFormatter { let formatter = NumberFormatter() formatter.locale = locale formatter.currencySymbol = "$" formatter.negativeFormat = "#,##0.##" formatter.positiveFormat = "#,##0.##" formatter.usesGroupingSeparator = true formatter.currencyDecimalSeparator = "." formatter.currencyGroupingSeparator = " " return formatter }And for example let it be some formatters:let enUs = build(locale: .init(identifier: "en_US")) let ruRu = build(locale: .init(identifier: "ru_RU"))So I need to get the same output in different locales: 10000 -> 10 000But i can't do that with setting `format` properties.And, if I set format to "#,##0.## ¤" (i just added ¤) then all thing will go fine - I get numbers with needed format with any locale. I don't understant is it normal? Or it's some sort of bug? Why does NSNumberFormatter work thhis way?
2
0
348
Jun ’20