Does NSNumberFormatter.stringFromNumber ever return nil?

前端 未结 1 1790
攒了一身酷
攒了一身酷 2021-01-17 20:30

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 Str

相关标签:
1条回答
  • 2021-01-17 21:17

    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

    0 讨论(0)
提交回复
热议问题