Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect if string contains emoji in Java?

Tags:

java

emoji

I would like to detect if a string contains emoji in Java.

I tried https://github.com/vdurmont/emoji-java but it is not maintained anymore and fails on new emojis.

For example - the following test fails:

EmojiManager.containsEmoji("This string contains beans 🫘") shouldBe true
like image 359
pixel Avatar asked Dec 22 '25 09:12

pixel


1 Answers

In Java 21 you will be able to use Character#isEmoji(int) to help you out.

like image 132
Laird Nelson Avatar answered Dec 23 '25 21:12

Laird Nelson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!