Creating Unicode character from its number

后端 未结 13 1821
挽巷
挽巷 2020-11-28 21:38

I want to display a Unicode character in Java. If I do this, it works just fine:

String symbol = \"\\u2202\";

symbol is equal to \"∂\". That\'

13条回答
  •  情歌与酒
    2020-11-28 22:20

    Remember that char is an integral type, and thus can be given an integer value, as well as a char constant.

    char c = 0x2202;//aka 8706 in decimal. \u codepoints are in hex.
    String s = String.valueOf(c);
    

提交回复
热议问题