How to get string from ASCII code in Swift?

39,541

As a character:

let c = Character(UnicodeScalar(65))

Or as a string:

let s = String(UnicodeScalar(UInt8(65)))

Or another way as a string:

let s = "\u{41}"

(Note that the \u escape sequence is in hexadecimal, not decimal)

Share:
39,541

Related videos on Youtube

YourMJK
Author by

YourMJK

Updated on July 09, 2022

Comments