Java Emoji Check filterEmoji(String source)

Here you can find the source of filterEmoji(String source)

Description

filter Emoji

License

Apache License

Declaration

public static String filterEmoji(String source) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
    public static String filterEmoji(String source) {
        if (source != null) {
            Pattern emoji = Pattern.compile("[\\x{10000}-\\x{10FFFF}]",
                    Pattern.UNICODE_CASE | Pattern.CASE_INSENSITIVE);
            Matcher emojiMatcher = emoji.matcher(source);
            if (emojiMatcher.find()) {
                source = emojiMatcher.replaceAll("[emoji]");
                return source;
            }/*from w  w w. j  a v  a  2  s.  co m*/
            return source;
        }
        return source;
    }
}

Related

  1. emoji(int hexEmoji)
  2. emoji(String emoji)
  3. isEmoji(char c)
  4. resolveToEmoji(String str)
  5. resolveToEmojiFromByte(String str)