I'm using NSNumberFormatter.localizedStringFromNumber(aDouble, numberStyle: .DecimalStyle)
to display a number to the end user. This works well, unless the number has many digits after the decimal.
For example, if aDouble
is 0.123, the generated string is 0.123 (in English). But if aDouble
is 0.1234 the string is 0.123.
How can I obtain a localized string for a number but have control over the number of digits displayed? I'd like to show 10-20 digits before rounding.
I don't see an API for creating a custom numberStyle
, it's restricted to presents like DecimalStyle
and ScientificStyle
. I do need it to be a localized representation so that the digits/symbols are displayed properly for the current language/locale.