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

熱點內容
缺氧為什麼老有污水 瀏覽:654
純凈水法語怎麼說 瀏覽:608
塔機提升電機用變頻器好用嗎 瀏覽:248
宿州凈水設備哪個品牌好 瀏覽:482
什麼化工生產廢水會含有重金屬 瀏覽:428
凱馬凈水器怎麼洗濾芯 瀏覽:235
魚缸濾芯怎麼清理 瀏覽:672
寧德膜結構污水池加蓋多少錢一平 瀏覽:991
水龍頭濾水機與凈水器哪個好 瀏覽:470
邁森源凈水器空氣凈化器怎麼樣 瀏覽:924
村污水排放方式怎麼寫 瀏覽:105
污水處理廠壽命統計 瀏覽:568
崇明區工業污水處理設備要多少錢 瀏覽:877
愉升商用飲水機不顯示什麼原因 瀏覽:96
凈水器退貨扣費怎麼辦 瀏覽:471
南陽廢水處理怎麼選 瀏覽:181
環氧樹脂膠一個kg 瀏覽:51
精密濾芯怎麼保護 瀏覽:474
趁熱過濾溶質在哪 瀏覽:988
煉金後的廢水如何處理 瀏覽:427