Unicode リテラル文字列を同等の Unicode 文字として出力する必要があります。
System.out.println("\u00A5"); // prints ¥
System.out.println("\\u"+"00A5"); //prints \u0045 I need to print it as ¥
この文字列をユニコード文字として評価するにはどうすればよいですか?
Unicode リテラル文字列を同等の Unicode 文字として出力する必要があります。
System.out.println("\u00A5"); // prints ¥
System.out.println("\\u"+"00A5"); //prints \u0045 I need to print it as ¥
この文字列をユニコード文字として評価するにはどうすればよいですか?
ここでの他のオプションの代わりとして、次を使用できます。
int codepoint = 0x00A5; // Generate this however you want, maybe with Integer.parseInt
String s = String.valueOf(Character.toChars(codepoint));
これは、基本的な多言語面以外の Unicode コードポイントでも機能するという点で、他の提案された手法よりも優れています。
文字列がある場合:
System.out.println((char)(Integer.parseInt("00A5",16)));
おそらく動作します(テストしていません)