TrimRightFunc returns a slice of the string s with all trailing Unicode code points c satisfying f(c) removed.
package main import ( "fmt" "strings" "unicode" ) func main() { fmt.Print(strings.TrimRightFunc("¡¡¡Hello, Gophers!!!", func(r rune) bool { return !unicode.IsLetter(r) && !unicode.IsNumber(r) })) }