NSNumberFormatter.stringFromNumber 曾经 return 是零吗?
Does NSNumberFormatter.stringFromNumber ever return nil?
在我看来,任何有效数字也可以表示为String
,所以我不知道为什么这个函数returns是String?
而不是String
.
我最好的猜测是因为遗留支持。这是来自官方文档:
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
在我看来,任何有效数字也可以表示为String
,所以我不知道为什么这个函数returns是String?
而不是String
.
我最好的猜测是因为遗留支持。这是来自官方文档:
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