Commit 0a6aea3d authored by lee_mingzhu's avatar lee_mingzhu

add log

parent 483fdabb
package cn.quantgroup.xyqb.util; package cn.quantgroup.xyqb.util;
import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
/** /**
...@@ -8,15 +8,10 @@ import java.util.regex.Pattern; ...@@ -8,15 +8,10 @@ import java.util.regex.Pattern;
* 过滤emoji表情 * 过滤emoji表情
*/ */
public class EmojiUtil { public class EmojiUtil {
private static final Pattern EMOJI = Pattern.compile("[\ud83c\udc00-\ud83c\udfff]|[\ud83d\udc00-\ud83d\udfff]|[\u2600-\u27ff]");
public static String filter(String str) { public static String filter(String str) {
if(str.trim().isEmpty()){ return str == null || str.trim().isEmpty() ? str : EMOJI.matcher(str).replaceAll("");
return str;
}
String pattern="[\ud83c\udc00-\ud83c\udfff]|[\ud83d\udc00-\ud83d\udfff]|[\u2600-\u27ff]";
String reStr="";
Pattern emoji=Pattern.compile(pattern);
Matcher emojiMatcher=emoji.matcher(str);
str=emojiMatcher.replaceAll(reStr);
return str;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment