So I know how to convert String to utf8 format like this
for character in strings.utf8 {
// for example A will converted to 65
var utf8Value = character
}
I already read the guide but can't find how to convert Unicode code point that represented by integer to String. For example: converting 65 to A. I already tried to use the "\u"+utf8Value but it still failed.
Is there any way to do this?
If you look at the enum definition for
Character
you can see the following initializer:If we then look at the struct UnicodeScalar, we see this initializer:
We can put them together, and we get a whole character
and if we want it in a string, it's just another initializer away...
Or (although I can't figure out why this one works) you can do