導航:首頁 > 凈水問答 > 如何過濾emoji表情

如何過濾emoji表情

發布時間:2024-03-21 05:01:05

1. python 怎麼過濾 emoji 表情符號

||濾該表情
[java] view plain
public static String filterEmoji(String source) {
if (!containsEmoji(source)) {
return source;// 包含直接返
}

StringBuilder buf = null;
int len = source.length();
for (int i = 0; i < len; i++) {
char codePoint = source.charAt(i);
if (!isEmojiCharacter(codePoint)) {
if (buf == null) {
buf = new StringBuilder(source.length());
}
buf.append(codePoint);
} else {
}
}
if (buf == null) {
return "";
} else {
if (buf.length() == len) {// 意義於盡能少toString重新字元串
buf = null;
return source;
} else {
return buf.toString();
}
}
}

[java] view plain
// 判別否包含Emoji表情
private static boolean containsEmoji(String str) {
int len = str.length();
for (int i = 0; i < len; i++) {
if (isEmojiCharacter(str.charAt(i))) {
return true;
}
}
return false;
}

private static boolean isEmojiCharacter(char codePoint) {
return !((codePoint == 0x0) ||
(codePoint == 0x9) ||
(codePoint == 0xA) ||
(codePoint == 0xD) ||
((codePoint >= 0x20) && (codePoint <= 0xD7FF)) ||
((codePoint >= 0xE000) && (codePoint <= 0xFFFD)) ||
((codePoint >= 0x10000) && (codePoint <= 0x10FFFF)));
}

閱讀全文

與如何過濾emoji表情相關的資料

熱點內容
凈水器反滲透口為什麼在滴水 瀏覽:836
2012年污水廠安全生產試題 瀏覽:632
制備離子交換樹脂的單體是 瀏覽:835
污水的處理法有哪些 瀏覽:802
生活污水產生多少污泥 瀏覽:486
環氧樹脂發光字價格 瀏覽:369
機械加工含油廢水怎麼處理 瀏覽:818
豬場污水處理平均多少錢一噸 瀏覽:176
養殖廢水cod排放標準是多少 瀏覽:729
過慮壺的過濾芯在哪裡買好 瀏覽:239
D型大孔吸附樹脂的密度 瀏覽:363
鍍鋅廢水ph多少 瀏覽:153
超濾機過濾好後氣泡 瀏覽:694
含亞鐵廢水是什麼顏色 瀏覽:893
物業清理污水井的溫馨提示 瀏覽:704
硫化污水怎麼處理 瀏覽:216
自然水體怎麼做污水指示 瀏覽:552
hepa過濾網怎麼做的 瀏覽:677
新換ro膜 瀏覽:926
永寧縣污水處理廠安全事故 瀏覽:711