Files
nysoure/server/utils/string.go
2025-09-09 21:26:26 +08:00

22 lines
316 B
Go

package utils
import (
"regexp"
"unicode"
)
func RemoveSpaces(s string) string {
reg := regexp.MustCompile(`\s+`)
return reg.ReplaceAllString(s, "")
}
func OnlyPunctuation(s string) bool {
for _, r := range s {
if unicode.IsPunct(r) || unicode.IsSpace(r) {
continue
}
return false
}
return true
}