Discussion 解説
For scalars that represent a number, numeric
is the numeric type of the scalar. For all other scalars, this property is nil
.
ある数を表すスカラーに対して、numeric
はそのスカラーの数値型です。全ての他のスカラーに対して、このプロパティはnil
です。
let scalars: [Unicode.Scalar] = ["4", "④", "⅕", "X"]
for scalar in scalars {
print(scalar, "-->", scalar.properties.numericType)
}
// 4 --> Optional(Swift.Unicode.NumericType.decimal)
// ④ --> Optional(Swift.Unicode.NumericType.digit)
// ⅕ --> Optional(Swift.Unicode.NumericType.numeric)
// X --> nil
This property corresponds to the “Numeric_Type” property in the Unicode Standard. このプロパティは、ユニコード標準における “Numeric_Type” に相当します。