Create string with emoji unicode flag countries

前端 未结 5 2147
北海茫月
北海茫月 2020-12-14 10:41

i need to create a String with a country flag unicode emoji..I did this:

StringBuffer sb = new StringBuffer();
sb.append(StringEscapeUtils.unescapeJava(\"\\\         


        
5条回答
  •  醉梦人生
    2020-12-14 11:18

    You should be able to do that simply using toChars from java.lang.Character.

    This works for me:

        StringBuffer sb = new StringBuffer();
        sb.append(Character.toChars(127467));
        sb.append(Character.toChars(127479));
        System.out.println(sb);
    

    prints

提交回复
热议问题