numericValue
The numeric value of the scalar.
Declaration
var numericValue: Double? { get }Discussion
For scalars that represent a numeric value, numericValue is the whole or fractional value. For all other scalars, this property is nil.
let scalars: [Unicode.Scalar] = ["4", "④", "⅕", "X"]
for scalar in scalars {
print(scalar, "-->", scalar.properties.numericValue)
}
// 4 --> Optional(4.0)
// ④ --> Optional(4.0)
// ⅕ --> Optional(0.2)
// X --> nilThis property corresponds to the “Numeric_Value” property in the Unicode Standard.