Contents

properties

Properties of this scalar defined by the Unicode standard.

Declaration

var properties: Unicode.Scalar.Properties { get }

Discussion

Use this property to access the Unicode properties of a Unicode scalar value. The following code tests whether a string contains any math symbols:

let question = "Which is larger, 3 * 3 * 3 or 10 + 10 + 10?"
let hasMathSymbols = question.unicodeScalars.contains(where: {
    $0.properties.isMath
})
// hasMathSymbols == true

See Also

Inspecting a Scalar