Initializer

init(_:)

Creates a character from a single-character string.

Declaration

init(_ s: String)

Parameters

s

The single-character string to convert to a Character instance. s must contain exactly one extended grapheme cluster.

Discussion

The following example creates a new character from the uppercase version of a string that only holds one character.

let a = "a"
let capitalA = Character(a.uppercased())

Relationships