I’m trying to create a char out of the utf code. I’m reading this code from a file which is a map of characters. All characters are specified by their UTF code.
0020 SPACE
0021 EXCLAMATION MARK
0022 QUOTATION MARK
.
.
.
After reading the code from the file, I end up with this code in a String. How can I convert this code(Stirng) to a char?
The codes are stored in hexadecimal so I think you want this:
I assume that none of your character codes exceed the maximum value that can be stored in a char, i.e. the characters in the Basic Multilingual Plane. Because your data format appears to be zero padded up to a maximum length of 4 hexadecimal digits, I assume that all the characters you need to consider are in fact in the BMP.
If this is not the case, you will need a different solution. See
Character.toChars(int).