Discussion 解説
For scalars that represent a numeric value, numeric
is the whole or fractional value. For all other scalars, this property is nil
.
ある数に関する値を表すスカラーに対して、numeric
は全体のまたは断片的な値です。全ての他のスカラーに対して、このプロパティは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 --> nil
This property corresponds to the “Numeric_Value” property in the Unicode Standard. このプロパティは、ユニコード標準における “Numeric_Value” に相当します。