如何判断15位身份证号是否为有效的号码? 如题...注意是15位的身份证..先谢过!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://epasser.aydc.com.cn/article/adp/2/content14477.html 里面有详细的说明 public static boolean isDigitStr(String str){ Pattern pattern = Pattern.compile("[0-9]+"); Matcher matcher = pattern.matcher((CharSequence)str); return matcher.matches(); } public static boolean isIdCardStr(String str) { Pattern pattern = Pattern.compile("\\d{15}"); Matcher matcher = pattern.matcher((CharSequence) str); return matcher.matches();} 按身份证的编码规则进行校验具体规则google一下 JTable中的那些表格模型 关于Java学习的问题 javax cache java web start 启动混乱 今天面试之后很郁闷,散点分! 初学的问题! 一个菜鸟关于J2EE环境变设置的问题 java怎样模拟键盘的输出? 诸位帮帮忙! 我的浏览器不支持java怎么办? 如何查找文件中的中文,并返回其行数 有个问题向各位高手请教一下,帮帮忙
Pattern pattern = Pattern.compile("[0-9]+");
Matcher matcher = pattern.matcher((CharSequence)str);
return matcher.matches(); }
public static boolean isIdCardStr(String str) {
Pattern pattern = Pattern.compile("\\d{15}");
Matcher matcher = pattern.matcher((CharSequence) str);
return matcher.matches();
}
具体规则google一下