unified code verification service
This commit is contained in:
17
api/pkg/mutil/mask/mask.go
Normal file
17
api/pkg/mutil/mask/mask.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package mask
|
||||
|
||||
import "strings"
|
||||
|
||||
func Email(email string) string {
|
||||
parts := strings.Split(email, "@")
|
||||
if len(parts) != 2 {
|
||||
return email
|
||||
}
|
||||
local := parts[0]
|
||||
if len(local) > 2 {
|
||||
local = local[:1] + "***" + local[len(local)-1:]
|
||||
} else {
|
||||
local = local[:1] + "***"
|
||||
}
|
||||
return local + "@" + parts[1]
|
||||
}
|
||||
Reference in New Issue
Block a user