0Pricing
Swift Academy · Lesson

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

  1. Characters and Grapheme Clusters
  2. Unicode Scalars and Code Points
  3. Counting and Iterating Characters
  4. Encoding Views: utf8, utf16, unicodeScalars
← Back to Swift Academy