【问题标题】:print out the whole Chinese dictionary with output { unicode, Chinese character)用输出 { unicode, Chinese character) 打印出整个中文字典
【发布时间】:2015-03-02 14:53:03
【问题描述】:

有人能告诉我如何用 Java 输出 { unicode, Chinese character) 打印出整个中文字典吗?

String index = String.valueOf(i) ;
String chineseChar = "\\" + "u4e0" + index ;
System.out.println (index + " => " + chineseChar );

最后一条语句打印出来 0 => \u4e00 问题是右边应该是一个汉字“一”。

unicode中中文编码的具体范围是多少?

【问题讨论】:

    标签: dictionary unicode chinese-locale


    【解决方案1】:

    只需使用整数加法

    String index = String.valueOf(i) ;
    int chineseChar = '\u4e00' + i;
    System.out.println (index + " => " + (char)chineseChar );
    

    【讨论】:

    • 感谢 BlueMandora 的快速回答,对我来说效果很好。
    猜你喜欢
    • 1970-01-01
    • 2012-06-08
    • 1970-01-01
    • 1970-01-01
    • 2017-05-14
    • 2020-07-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多