public static boolean checkChinese(String sequence) { final String format = "[\\u4E00-\\u9FA5\\uF900-\\uFA2D]"; boolean result = false; Pattern pattern = Pattern.compile(format); Matcher matcher = pattern.matcher(sequence); result = matcher.find(); return result; }
public static boolean checkNickname(String sequence) { final String format = "[^\\u4E00-\\u9FA5\\uF900-\\uFA2D\\w-_]"; Pattern pattern = Pattern.compile(format); Matcher matcher = pattern.matcher(sequence); return !matcher.find(); }