Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 unicode 十六进制值的字符串表示形式列表,例如“0x20000”()和“0x00F8”(ø),我需要获取其 int 代码点,以便可以使用以下函数:char[] chars = Character .toChars(0x20000);
这应该涵盖 BMP 以及补充字符。我找不到任何方法来做到这一点,所以很高兴得到一些帮助。
您可以创建自己的NumberFormat实现,但比您可以执行以下操作更容易:
NumberFormat
String hexString = "0x20000"; int hexInt = Integer.parseInt(hexString.substring(2), 16); String stringRepresentation = new String(Character.toChars(hexInt)); System.out.println(stringRepresentation); //prints ""