server/libfic/utils.go

12 lines
195 B
Go
Raw Normal View History

2018-01-18 10:07:50 +00:00
package fic
import (
"regexp"
"strings"
2018-01-18 10:07:50 +00:00
)
func ToURLid(str string) string {
re := regexp.MustCompile("[^a-zA-Z0-9]+")
return strings.TrimSuffix(re.ReplaceAllLiteralString(str, "-"), "-")
2018-01-18 10:07:50 +00:00
}