導航:首頁 > 凈水問答 > 如何過濾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表情相關的資料

熱點內容
山西簡約污水凈化費用是多少 瀏覽:421
反滲透出水端壓力有多少 瀏覽:294
超濾膜材料前景 瀏覽:944
水處理砂崗正反洗原理 瀏覽:987
大連一體化污水處理裝置 瀏覽:210
熱水處理費 瀏覽:121
神鋼空調濾芯在哪裡 瀏覽:260
志高ro膜是通用的嗎 瀏覽:300
污水水清ph值高怎麼回事 瀏覽:979
泥溝村污水處理 瀏覽:557
上火喝純凈水會怎麼樣 瀏覽:90
mysqljson數組過濾 瀏覽:437
飲水機800g多少斤 瀏覽:630
最早合成的樹脂 瀏覽:3
怎麼舉報抖音凈化器 瀏覽:181
超濾膜水壓范圍是 瀏覽:218
流亡黯道物品過濾 瀏覽:967
ps超濾膜透氣 瀏覽:490
純水機上水管怎麼接 瀏覽:12
興蓉環境日處理污水多少萬噸 瀏覽:214