Home  >  Article  >  Java  >  How to implement Springboot's support for Emoji expressions

How to implement Springboot's support for Emoji expressions

王林
王林forward
2023-05-12 11:16:051560browse

Effect display diagram:

Pass parameters

How to implement Springboots support for Emoji expressions

Conversion storage:

How to implement Springboots support for Emoji expressions

Parse return page display:

How to implement Springboots support for Emoji expressions

Start

1. Add dependencies to pom.xml:

<dependency>
            <groupId>com.vdurmont</groupId>
            <artifactId>emoji-java</artifactId>
            <version>4.0.0</version>
        </dependency>

2. Before receiving parameters and storing them, Convert:

EmojiParser.parseToAliases(xxxxemoji表情参xxx)

How to implement Springboots support for Emoji expressions

##Test example:

System.out.println(EmojiParser.parseToAliases("uD83DuDE0EuD83DuDE02uD83EuDD37uD83DuDCAAuD83DuDC7D"));

How to implement Springboots support for Emoji expressions

# PS: Some people may have questions after reading this. If the parameter value is not to save emoji expressions, can it still be successful?

The best way to eliminate doubts is to take action:


How to implement Springboots support for Emoji expressions

3. The converted data has been stored, so in the end you only need to obtain Just convert it back when it comes out:

EmojiParser.parseToUnicode(xxxx转化后的emoji值xxxx)

How to implement Springboots support for Emoji expressions

##System.out.println(EmojiParser.parseToUnicode(":sunglasses::joy::shrug::muscle: :alien:"));

The above is the detailed content of How to implement Springboot's support for Emoji expressions. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete