Skip to content
Snippets Groups Projects
Commit e48a97aa authored by Johan de Klerk's avatar Johan de Klerk
Browse files

String util for valid username check

parent 547cdc02
No related branches found
No related tags found
No related merge requests found
...@@ -82,6 +82,11 @@ func IsAlphaNumericOrDash(str string) bool { ...@@ -82,6 +82,11 @@ func IsAlphaNumericOrDash(str string) bool {
return regex.MatchString(str) return regex.MatchString(str)
} }
func IsValidUsername(str string) bool {
regex := regexp.MustCompile("^[a-zA-Z0-9-.@]*$")
return regex.MatchString(str)
}
func Equal(a string, b string) bool { func Equal(a string, b string) bool {
return strings.TrimSpace(strings.ToLower(a)) == strings.TrimSpace(strings.ToLower(b)) return strings.TrimSpace(strings.ToLower(a)) == strings.TrimSpace(strings.ToLower(b))
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment