Print string literal unicode as the actual character

后端 未结 4 1022
自闭症患者
自闭症患者 2020-12-30 03:44

In my Java application I have been passed in a string that looks like this:

\"\\u00a5123\"

When printing that string into the console, I get the same string

4条回答
  •  时光取名叫无心
    2020-12-30 04:26

    Could replace the above with this:

    System.out.println((char)0x63A5);
    

    Here is the code to print all of the box building unicode characters.

    public static void printBox()
    {
        for (int i=0x2500;i<=0x257F;i++)
        {
            System.out.printf("0x%x : %c\n",i,(char)i);
        }
    }
    

提交回复
热议问题