简体   繁体   中英

Print the unicode code instead of character

I would like eclipse to allow to print and save a unicode code instead of the character (For use in another program after).

String string = "\u2588";

I want the output to be \█ not the block character.

First time posting so sorry for anything done wrong :(.

String string = "\\u2588";

如果使用两个反斜杠,则不会尝试检测转义序列

反斜杠\\转义字符 ,要打印实际的'\\'使用"\\\\"

String s = "\\u2588"

Use this code for printing unicode char

String unicodeMessage =
        "\u7686\u3055\u3093\u3001\u3053\u3093\u306b\u3061\u306f";

        PrintStream out = new PrintStream(System.out, true, "UTF-8");
        out.println(unicodeMessage);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM