package com.tms.common.utils;
import com.baomidou.mybatisplus.toolkit.StringUtils;
public class EncryptionUtils {
/**
* 定义所有常量
*/
public static final int ONE = 1;
public static final int TWO = 2;
/*
* 姓名
* */
public static String desensitizedName(String str) {
if (str == null) {
return null;
}
if (str.length() == ONE) {
return str;
} else if (str.length() == TWO) {
return str.substring(0, 1) +"*";
} else {
Integer length = str.length();
StringBuffer middle = new StringBuffer();
for (int i = 0; i < str.substring(1, length - 1).length(); i++) {
middle.append("*");
}
return str.substring(0, 1) + middle + str.substring(length
java数据打码/脱敏工具类(姓名,手机号码,身份证,详细地址)
最新推荐文章于 2024-07-29 14:22:26 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)