Unicode Scalars and Code Points
Access the underlying scalar values of text.
Unicode Scalars
A Unicode scalar is a single code point in the Unicode standard, represented by Unicode.Scalar. Characters are built from one or more scalars.
let scalar: Unicode.Scalar = "A"
print(scalar)
print(scalar.value)The value Property
Each scalar has a numeric .value: its Unicode code point as a number. The letter A is 65.
let a: Unicode.Scalar = "A"
let z: Unicode.Scalar = "Z"
print(a.value, z.value)All lessons in this course
- Characters and Grapheme Clusters
- Unicode Scalars and Code Points
- Counting and Iterating Characters
- Encoding Views: utf8, utf16, unicodeScalars