ruoyi-common/src/main/java/com/ruoyi/common/utils/ChineseUtils.java
@@ -9,7 +9,18 @@ * @return */ public static boolean isChinese(String str) { String regex = "[\\u4e00-\\u9fa5]+"; return str.matches(regex); for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); if (isChineseCharacter(c)) { return true; } } return false; } private static boolean isChineseCharacter(char c) { // 汉字的Unicode编码范围是0x4E00到0x9FA5 return c >= 0x4E00 && c <= 0x9FA5; } }