I read this question and its answers here: Java: Convert String “\uFFFF” into char. This question, although very close to what I require, doesn't answer my requirement.
What if the string is formed by String ori = new String("\"" + "\u" + n + "\"");
where n is a string formed by Integer.toString(i) where i is an int? How can this string variable ori
be converted into a Unicode Character?
The chain from i to n is as follows:
String n = Integer.toString(i);
n = "0000".substring(n.length()) + n;
In that case, how are those replies modulated? For instance,
char c = "\uFFFF".toCharArray()[0];
?
I checked. The above code can't be replaced by: char c = ori.toCharArray()[0];
Since the coversion is within the program, hard-coding the value like shown:
char c = '\uFFFF';
is not possible for my codes.
One could have a look at Character and Byte Streams and the example program StreamConverter.java. Replace the stream "\u65e5\u672c\u8a9e\u6587\u5b57\u5217" with my entry, for instance, "\u005a" and one would have the Character Z in both the console and the GUI.
Also, look at the program and stringConverter.java, where the each of the 6-element integer strings is replaced by a UTF character.
But why that code works, but not mine?!