package com.ict.compent.wx;

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

/**
 * 微信过滤表情
 * @author hsw
 *
 */
public class EmojiFilter {

    public static String filterEmoji(String source) {
        if (source == null) {
            return source;
        }
        Pattern emoji = Pattern.compile("[\ud83c\udc00-\ud83c\udfff]|[\ud83d\udc00-\ud83d\udfff]|[\u2600-\u27ff]",
                Pattern.UNICODE_CASE | Pattern.CASE_INSENSITIVE);
        Matcher emojiMatcher = emoji.matcher(source);
        if (emojiMatcher.find()) {
            source = emojiMatcher.replaceAll("*");
            return source;
        }
        return source;
    }
}

 

相关文章:

  • 2021-11-01
  • 2022-12-23
  • 2021-10-27
  • 2022-12-23
  • 2021-11-27
  • 2022-01-21
  • 2021-12-27
猜你喜欢
  • 2022-03-02
  • 2021-07-09
  • 2021-11-30
  • 2021-12-24
  • 2021-10-07
相关资源
相似解决方案