Mysql:

    select REPLACE(idcard, SUBSTR(mobile,4,12), '************') idcard from sys_users
    select insert(idcard,4, 12, '*************') idcard from sys_users ;

 

java代码:
1、身份证可能是18为或者15位

if (newTBProjectCorpInfo.getPersonidcard().length() == 18) {
            newTBProjectCorpInfo.setPersonidcard(newTBProjectCorpInfo.getPersonidcard().replaceAll("(\\d{4})\\d{10}(\\d{4})", "$1****$2"));
        } else if (newTBProjectCorpInfo.getPersonidcard().length() == 15) {
            newTBProjectCorpInfo.setPersonidcard(newTBProjectCorpInfo.getPersonidcard().replaceAll("(\\d{4})\\d{8}(\\d{4})", "$1****$2"));
        }

2, 对

User.setPersonidcard(User.getPersonidcard().replaceAll("(\\w{4})\\w{0,}(\\w{4})", "$1****$2"));

 




相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-28
  • 2021-12-18
  • 2022-12-23
  • 2021-06-19
猜你喜欢
  • 2022-12-23
  • 2021-07-26
  • 2021-06-24
  • 2022-12-23
  • 2022-02-19
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案