init: 1.0.0

This commit is contained in:
Chang lue Tsen
2025-04-25 12:08:29 +09:00
commit 8addcc584b
1031 changed files with 76472 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
package tool
import (
"strings"
)
func MaskEmail(email string) string {
atIndex := strings.Index(email, "@")
if atIndex == -1 || atIndex == 0 || atIndex == len(email)-1 {
return email
}
localPart := email[:atIndex]
domainPart := email[atIndex+1:]
// 本地部分需要至少保留首字符和末字符
if len(localPart) < 2 {
return email
}
// 替换本地部分中间字符为星号
maskedLocal := string(localPart[0]) + strings.Repeat("*", len(localPart)-2) + string(localPart[len(localPart)-1])
// 返回处理后的邮箱地址
return maskedLocal + "@" + domainPart
}