mirror of
https://gitee.com/lauix/HFish
synced 2025-05-12 04:48:01 +08:00
10 lines
205 B
Go
10 lines
205 B
Go
|
package passwd
|
||
|
|
||
|
import "regexp"
|
||
|
|
||
|
// 密码脱敏
|
||
|
func Desensitization(str string, x string) string {
|
||
|
re, _ := regexp.Compile("(\\S{1})(\\S{1,20})(\\S{1})")
|
||
|
return re.ReplaceAllString(str, "$1"+x+"$3")
|
||
|
}
|