Does NSNumberFormatter.stringFromNumber ever return nil?
Asked Answered
E

1

10

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.

Ecdysiast answered 23/1, 2015 at 4:35 Comment(0)
M
5

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

Mitrailleuse answered 5/6, 2015 at 16:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.