This commit is contained in:
Looly
2024-12-08 18:17:41 +08:00
parent 15c1237ecc
commit 45df318b56
12 changed files with 149 additions and 51 deletions

View File

@@ -312,6 +312,28 @@ public class CharUtil implements CharPool {
return SLASH == c || BACKSLASH == c;
}
/**
* 是否为零宽字符
*
* @param c 字符
* @return 是否为零宽字符
*/
public static boolean isZeroWidthChar(final char c) {
switch (c) {
case '\u200B': // 零宽空格
case '\u200C': // 零宽非换行空格
case '\u200D': // 零宽连接符
case '\uFEFF': // 零宽无断空格
case '\u2060': // 零宽连字符
case '\u2063': // 零宽不连字符
case '\u2064': // 零宽连字符
case '\u2065': // 零宽不连字符
return true;
default:
return false;
}
}
/**
* 比较两个字符是否相同
*