mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-05 17:37:59 +08:00
修复脱敏银行卡号长度bug
This commit is contained in:
parent
1040d30500
commit
d606236923
@ -23,6 +23,7 @@
|
||||
* 【core 】 修复TypeUtil.getTypeArgument对实现接口获取不全面问题(issue#I7CRIW@Gitee)
|
||||
* 【core 】 修复BeanUtil.isCommonFieldsEqual判空导致的问题
|
||||
* 【extra 】 修复CompressUtil.createArchiver 将文件压缩为tgz时文件名规则无效问题(issue#I7LLL7@Gitee)
|
||||
* 【core 】 修复脱敏银行卡号长度bug(pr#3210@Github)
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
# 5.8.20(2023-06-16)
|
||||
|
@ -321,7 +321,7 @@ public class DesensitizedUtil {
|
||||
if (StrUtil.isBlank(bankCardNo)) {
|
||||
return bankCardNo;
|
||||
}
|
||||
bankCardNo = StrUtil.replace(bankCardNo," ","");
|
||||
bankCardNo = StrUtil.cleanBlank(bankCardNo);
|
||||
if (bankCardNo.length() < 9) {
|
||||
return bankCardNo;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public class DesensitizedUtilTest {
|
||||
Assert.assertEquals("d*************@gmail.com.cn", DesensitizedUtil.desensitized("duandazhi-jack@gmail.com.cn", DesensitizedUtil.DesensitizedType.EMAIL));
|
||||
Assert.assertEquals("**********", DesensitizedUtil.desensitized("1234567890", DesensitizedUtil.DesensitizedType.PASSWORD));
|
||||
Assert.assertEquals("1101 **** **** **** 3256", DesensitizedUtil.desensitized("11011111222233333256", DesensitizedUtil.DesensitizedType.BANK_CARD));
|
||||
Assert.assertEquals("6227 **** **** *** 5123", DesensitizedUtil.desensitized("6227880100100105123", DesensitizedUtil.DesensitizedType.BANK_CARD));
|
||||
Assert.assertEquals("6227 **** **** **** 123", DesensitizedUtil.desensitized("6227880100100105123", DesensitizedUtil.DesensitizedType.BANK_CARD));
|
||||
Assert.assertEquals("192.*.*.*", DesensitizedUtil.desensitized("192.168.1.1", DesensitizedUtil.DesensitizedType.IPV4));
|
||||
Assert.assertEquals("2001:*:*:*:*:*:*:*", DesensitizedUtil.desensitized("2001:0db8:86a3:08d3:1319:8a2e:0370:7344", DesensitizedUtil.DesensitizedType.IPV6));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user