I have an array of UInt32 values. I would like to convert this array to a String
.
This doesn't work:
let myUInt32Array: [UInt32] = [72, 101, 108, 108, 111, 128049]
let myString = String(myUInt32Array) // error
let myString = String(stringInterpolationSegment: myUInt32Array) // [72, 101, 108, 108, 111, 128049] (not what I want)
These SO posts show UTF8
and UTF16
:
- How can I create a String from UTF8 in Swift?
- Is there a way to create a String from utf16 array in swift?