4 changed files with 42 additions and 6 deletions
@ -0,0 +1,29 @@ |
|||||
|
package com.epmet.commons.tools.utils; |
||||
|
|
||||
|
import java.util.regex.Matcher; |
||||
|
import java.util.regex.Pattern; |
||||
|
|
||||
|
/** |
||||
|
* desc: |
||||
|
* |
||||
|
* @author: LiuJanJun |
||||
|
* @date: 2022/7/22 9:45 下午 |
||||
|
* @version: 1.0 |
||||
|
*/ |
||||
|
public class StrUtil { |
||||
|
|
||||
|
private static final Pattern emoji = Pattern.compile("[\ud83c\udc00-\ud83c\udfff]|[\ud83d\udc00-\ud83d\udfff]|[\u2600-\u27ff]", Pattern.UNICODE_CASE | Pattern.CASE_INSENSITIVE); |
||||
|
|
||||
|
public static String filterEmoji(String source) { |
||||
|
|
||||
|
if (source != null) { |
||||
|
Matcher emojiMatcher = emoji.matcher(source); |
||||
|
if (emojiMatcher.find()) { |
||||
|
source = emojiMatcher.replaceAll(""); |
||||
|
return source; |
||||
|
} |
||||
|
return source; |
||||
|
} |
||||
|
return source; |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue