mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 12:17:24 +00:00
22 lines
316 B
Go
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
|
|
}
|