package fic import ( "regexp" "strings" ) // ToURLid converts the given string to a valid URLid. func ToURLid(str string) string { re := regexp.MustCompile("[^a-zA-Z0-9]+") return strings.TrimSuffix(re.ReplaceAllLiteralString(str, "-"), "-") }