Post

Replies

Boosts

Views

Activity

Zero symbol in MeasurementFormatter
I'm having problems to declare/use a zero symbol for an unknown value when using MeasurementFormatter: let numberFormatter = NumberFormatter() numberFormatter.numberStyle = .decimal numberFormatter.zeroSymbol = "?" numberFormatter.string(from: 0.0) // '?' let formatter = MeasurementFormatter() formatter.unitOptions = .providedUnit formatter.numberFormatter = numberFormatter var distance = Measurement(value: 0, unit: .parsecs) formatter.string(from: distance) // '0 pc' - expected: '? pc'Trying different declarations of the value such as Double.zero doesn't change the output. Is this a conceptual thing or am I missing something here? Might this even be a bug?
5
0
805
May ’20