Creating Unicode character from its number

后端 未结 13 1805
挽巷
挽巷 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:19

    This is how you do it:

    int cc = 0x2202;
    char ccc = (char) Integer.parseInt(String.valueOf(cc), 16);
    final String text = String.valueOf(ccc);
    

    This solution is by Arne Vajhøj.

提交回复
热议问题