rockerhieu/emojicon

怎么把输出来的表情转换成类似这样的字符串\ue32d

nicech6 opened this issue · 2 comments

怎么把输出来的表情转换成类似这样的字符串\ue32d

public class Main {

    public static void main(String[] args) {
        String a = "你好,世界!";
        for (int i = 0; i < a.codePointCount(0, a.length()); i++) {
            int codePoint = a.codePointAt(i);
            System.out.println(Integer.toHexString(codePoint));
        }
        // 输出:4f60 597d ff0c 4e16 754c ff01
        System.out.println("\u4f60\u597d\uff0c\u4e16\u754c\uff01");
        // 输出:你好,世界!
    }

}