Does NSNumberFormatter.stringFromNumber ever return nil?

淺唱寂寞╮ 提交于 2019-12-04 03:09:02

问题


It seems to me that any valid number can also be expressed as a String, so I don't know why this function returns a String? instead of a String.


回答1:


My best guess would be because of the legacy support. This is from the official documentation:

The behavior of an NSNumberFormatter object can conform either to the range of behaviors existing prior to OS X v10.4 or to the range of behavior since that release. NSNumberFormatter Class Reference



来源:https://stackoverflow.com/questions/28103113/does-nsnumberformatter-stringfromnumber-ever-return-nil

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!