diff options
Diffstat (limited to 'skate/slugify.go')
-rw-r--r-- | skate/slugify.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/skate/slugify.go b/skate/slugify.go index e8fa8bf..5cdc838 100644 --- a/skate/slugify.go +++ b/skate/slugify.go @@ -1,18 +1,17 @@ package skate import ( - "bytes" "fmt" "strings" ) // slugifyString is a basic string slugifier. func slugifyString(s string) string { - var buf bytes.Buffer + var sb strings.Builder for _, c := range strings.TrimSpace(strings.ToLower(s)) { if (c > 96 && c < 123) || (c > 47 && c < 58) || (c == 32) || (c == 9) || (c == 10) { - fmt.Fprintf(&buf, "%c", c) + fmt.Fprintf(&sb, "%c", c) } } - return strings.Join(strings.Fields(buf.String()), " ") + return strings.Join(strings.Fields(sb.String()), " ") } |