Standard library / strings
strings.TrimRightFunc()
Removes trailing runes satisfying f. Expected stdout: '12go\n'.
Formal Syntax & Structure
go syntaxgo
func TrimRightFunc(s string, f func(rune) bool) stringParameters & Attributes
| Name | Type | Description |
|---|---|---|
| s | string | Input text or sequence. |
| f | func(rune) bool | Predicate over decoded runes. |
Return Value
string
Removes trailing runes satisfying f.
Working Example
Example Snippetgo
package main
import ( "fmt" "strings" "unicode")
func main() { fmt.Println(string(strings.TrimRightFunc("12go34", unicode.IsDigit)))}