Found cool function in the strings package today, TrimFunc
!
This allows you to remove any character (rune
) you want from the suffix or prefix of a string by passing a function and returning true if something should be removed.
Example
strings.TrimFunc("¡¡¡Hello, Gophers!!!", func(r rune) bool {
return !unicode.IsLetter(r) && !unicode.IsNumber(r)
})