Improve search

This commit is contained in:
2025-09-08 21:59:55 +08:00
parent 2848e4c5e1
commit 24ba97817a
3 changed files with 21 additions and 6 deletions

View File

@@ -1,8 +1,21 @@
package utils
import "regexp"
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
}