1

この文字列を変換するにはどうすればよいですか:この文字列には、Unicode文字unicodetoString( "\ u0064")とstringtounicode( "a")のようなUnicodeへの文字列が含まれていますか?

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;
}    
4

1 に答える 1

1

Unicode を文字列に変換するには

StringEscapeUtils .unescapeJava(unicodeString)

于 2013-07-17T07:00:40.630 に答える