small string split join optimization

This commit is contained in:
yusing
2024-12-19 00:54:31 +08:00
parent 654194b274
commit e7be27413c
20 changed files with 160 additions and 50 deletions

View File

@@ -8,8 +8,10 @@ import (
"golang.org/x/text/language"
)
// CommaSeperatedList returns a list of strings split by commas,
// then trim spaces from each element.
func CommaSeperatedList(s string) []string {
res := strings.Split(s, ",")
res := SplitComma(s)
for i, part := range res {
res[i] = strings.TrimSpace(part)
}