mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
Merge branch 'v6-dev' of gitee.com:dromara/hutool into v6-dev
This commit is contained in:
commit
8cbaf66d0c
@ -168,7 +168,7 @@ public class IdcardUtil {
|
||||
* @param idCard 18位身份编码
|
||||
* @return 15位身份编码
|
||||
*/
|
||||
public static String convert18To15(String idCard) {
|
||||
public static String convert18To15(final String idCard) {
|
||||
if (StrUtil.isNotBlank(idCard) && IdcardUtil.isValidCard18(idCard)) {
|
||||
return idCard.substring(0, 6) + idCard.substring(8, idCard.length() - 1);
|
||||
}
|
||||
@ -559,7 +559,7 @@ public class IdcardUtil {
|
||||
public static int getGender(String idcard) {
|
||||
Assert.notBlank(idcard);
|
||||
final int len = idcard.length();
|
||||
if (len < CHINA_ID_MIN_LENGTH) {
|
||||
if (!(len == CHINA_ID_MIN_LENGTH || len == CHINA_ID_MAX_LENGTH)) {
|
||||
throw new IllegalArgumentException("ID Card length must be 15 or 18");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user