SuperThomasLab SuperThomasLab - 5 months ago 24
Java Question

Java convert String to Unicode character. "U+1F600" = 😀

Please note that this question is not a duplicate.

I have a String like this:

// My String
String myString = "U+1F600";

// A method to convert the String to a real character
String unicodeCharacter = convertStringToUnicode(myString);

// Then this should print:

Answer

is this what you are looking for??

System.out.print(Character.toChars(0x1f600));

Example:

public static void main(String[] args) {
String myString = "U+1F600";
System.out.print(Character.toChars(Integer.parseInt(myString.substring(2), 16)));
Comments