123456789101112131415161718 |
- package utils
- import (
- "crypto/md5"
- "encoding/hex"
- "regexp"
- )
- func EmailIsValid(email string) bool {
- regexpe := regexp.MustCompile(`^[a-z0-9._%+\-]+@[a-z0-9.\-]+\.[a-z]{2,4}$`)
- return regexpe.MatchString(email)
- }
- func GetMd5(str string) string {
- hasher := md5.New()
- hasher.Write([]byte(str))
- return hex.EncodeToString(hasher.Sum(nil))
- }
|