mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-05 17:37:59 +08:00
add idcard validate
This commit is contained in:
parent
4aee10da40
commit
3d11e2baa2
@ -16,6 +16,7 @@
|
||||
* 【core 】 增加IoUtil.writeObj(issue#I1FZIE)
|
||||
* 【core 】 增加FastStringWriter
|
||||
* 【core 】 增加NumberUtil.ceilDiv方法(pr#858@Github)
|
||||
* 【core 】 IdcardUtil增加省份校验(issue#859@Github)
|
||||
|
||||
### Bug修复
|
||||
* 【core 】 修复URLBuilder中请求参数有`&`导致的问题(issue#850@Github)
|
||||
|
@ -218,6 +218,12 @@ public class IdcardUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 省份
|
||||
final String proCode = idCard.substring(0, 2);
|
||||
if (null == CITY_CODES.get(proCode)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//校验生日
|
||||
if (false == Validator.isBirthday(idCard.substring(6, 14))) {
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user