ios - 在印度语言环境中使用 NSNumberFormatter 时如何显示阿拉伯数字?

标签 ios macos nsnumberformatter

以下内容返回 १२३४५६७८९० 而不是 123456790:

let numberFormatter = NSNumberFormatter()
numberFormatter.locale = NSLocale(localeIdentifier: "hi_IN")
numberFormatter.stringFromNumber(1234567890)

有没有办法配置NSNumberFormatter以便使用阿拉伯数字?

最佳答案

如果您想获取١٢٣٤٥٦٧٨٩٠,请使用localeIdentifier ar_SAar_IN

如果您仍想获得 123456789 的返回值,那么您可以使用在其各自的脚本中不包含数字的任何其他印度语言环境。例如en_IN。请参阅 https://gist.github.com/jacobbubu/1836273 了解您要使用的区域设置标识符。

关于ios - 在印度语言环境中使用 NSNumberFormatter 时如何显示阿拉伯数字?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36193112/

相关文章:

ios - UILabel 显示 1k 表示 int 值 1000 和 2k 表示 2000 等等

ios - 在我的应用程序中多次使用相同的代码

ios - iZip 如何与 DropBox 交互?

Mysql2::Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock'

c++ - 等同于 Windows 操作系统的 Mac OSX API

ios - 使用 NSNumberFormatter 将数字转换为格式

ios - ionic 1 - Cordova - 谷歌地图 : Disappeared buttons on map - only IOS

iphone - UIScrollview subview 在枚举时显示不正确的帧

java - 为 Mac OS X 安装 Java JDK 7 后 - mvn -version 仍然显示 java 版本 1.6.0_31

ios - 拼出序数