使用正则来判断字符串中是否包含中文
/**
* @ClassName : CheckChinese
* @Description : 是否为中文
* @Author: Jinwei
* @Email: CloverAn@aliyun.com
* @Date: 2021-01-28 11:28
*/
public class CheckChinese {
/**
* 用正则来判断字符串中是否包含中文
* @param sequence
* @return boolean
*/
public static boolean checkChinese(String sequence) {
final String format = "[\u4e00-\u9fa5]";
boolean result = false;
Pattern pattern = Pattern.compile(format);
Matcher matcher = pattern.matcher(sequence);
result = matcher.find();
return result;
}
}