// 判断身份证字符是否合法
private static boolean isAllNum(String cardNumber) {
String match = cardNumber.length() == 18 ? "^[0-9]{17}([0-9]|X|x)$" : "^[0-9]{15}$";
Pattern pattern = Pattern.compile(match);
Matcher isNum = pattern.matcher(cardNumber);
return isNum.matches();
}
Android studio 判断身份证字符是否合法
最新推荐文章于 2024-08-25 17:01:43 发布