java 替换emoji表情字符串

public static String filterEmoji(String source) { 
          if (source != null )
          {
              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;
         }
         return source; 
      }

猜你喜欢

转载自15110030913.iteye.com/blog/2316109
今日推荐