update utils.go
Signed-off-by: Nathan13888 <29968201+Nathan13888@users.noreply.github.com>
This commit is contained in:
parent
6cdd9ddf97
commit
2a3a9bf41f
8
utils.go
8
utils.go
|
@ -2,6 +2,7 @@ package main
|
|||
|
||||
import (
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
|
@ -16,7 +17,12 @@ func GetAbsPath(path string) string {
|
|||
return absPath
|
||||
}
|
||||
|
||||
var lowerAlphaRegex = regexp.MustCompile("[^a-z]+")
|
||||
|
||||
func NormalizeName(name string) string {
|
||||
trimmed := strings.Trim(name, " ")
|
||||
return strings.ToLower(trimmed)
|
||||
lowered := strings.ToLower(trimmed)
|
||||
filtered := lowerAlphaRegex.ReplaceAllString(lowered, "")
|
||||
|
||||
return filtered
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue