How can I convert this string: This string contains the unicode character unicodetoString("\u0064") and string to unicode like stringtounicode("a")?
public static String GetUnicode(String str_code) {
String hexCode = Integer.toHexString(str_code.codePointAt(0)).toUpperCase();
String hexCodeWithAllLeadingZeros = "0000" + hexCode;
String hexCodeWithLeadingZeros = hexCodeWithAllLeadingZeros
.substring(hexCodeWithAllLeadingZeros.length() - 4);
hexCodeWithLeadingZeros = "\\u" + hexCodeWithLeadingZeros;
System.out.println("Unicode " + hexCodeWithLeadingZeros);
return hexCodeWithLeadingZeros;
}
public static String GetUnicode(String str_code) { // TODO Auto-generated method stub //StringBuilder hexcode = Integer.toHexString(str_code.codePointAt(0)).toUpperCase(); String hexCode = Integer.toHexString(str_code.codePointAt(0)).toUpperCase(); String hexCodeWithAllLeadingZeros = "0000" + hexCode; String hexCodeWithLeadingZeros = hexCodeWithAllLeadingZeros .substring(hexCodeWithAllLeadingZeros.length() - 4); String myunicode = "\\u" + hexCodeWithLeadingZeros; // System.out.println("\\u" + hexCodeWithLeadingZeros); return myunicode; }