Create string with emoji unicode flag countries

前端 未结 5 2164
北海茫月
北海茫月 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:08

    If you want to use emojis often, it could be good to use a library that would handle that unicode stuff for you: emoji-java

    You would just add the maven dependency:

    
      com.vdurmont
      emoji-java
      1.0.0
    
    

    And call the EmojiManager:

    Emoji emoji = EmojiManager.getForAlias("fr");
    System.out.println("HEY: " + emoji.getUnicode());
    

    The entire list of supported emojis is here.

提交回复
热议问题