Package slug generate slug from Unicode string, URL-friendly slugify with multiple languages support.
To install this module use go get
as:
$ go get -u github.com/goloop/slug
To use this module import it as: github.com/goloop/slug
Use the Make
method to convert a string to slug.
package main
import (
"fmt"
"github.com/goloop/slug"
)
func main() {
// Simple generate slug from the string.
s := slug.Make("Hello 世界")
h := "https://example.com/"
fmt.Printf("%s%s\n", h, s)
// Output: https://example.com/Hello-Shi-Jie
}
-
Lower(t string) string
Lower returns slug in lowercase.
-
Make(t string) string
Make returns slug from string.
-
Upper(t string) string
Upper returns slug in uppercase.
-
Version() string
Version returns the version of the module.
-
*New() *Slug
New returns pointer to Slug.
-
Lang(l string) *Slug
Lang sets the type of language features to use during slugify.
-
Lower(t string) string
Lower returns slug in lowercase.
-
Make(t string) string
Make returns slug from string.
-
Upper(t string) string
Upper returns slug in uppercase.