Standard library / strings

strings.TrimRight()

Removes trailing runes in cutset; stops at the first nonmember. Expected stdout: '.go\n'.

Formal Syntax & Structure

go syntaxgo
func TrimRight(s, cutset string) string

Parameters & Attributes

NameTypeDescription
sstringInput text or sequence.
cutsetstringSet of code points to remove from the indicated ends.

Return Value

string

Removes trailing runes in cutset; stops at the first nonmember.

Working Example

Example Snippetgo
package main
import (  "fmt"  "strings")
func main() {  fmt.Println(string(strings.TrimRight(".go..", ".")))}
Go Reference