string.trimRight

This function returns a slice of the input string with all the trailing Unicode code points contained in the cutset removed from the right.

Syntax

string.trimRight(str, cutset)

Arguments

Argument

Type

Description

str

string

Source string

cutset

string

Set of characters to be removed from the right

Returns

Type

Description

string

Slice of the source string with all trailing Unicode code points contained in the cutset removed from the right.

Examples

  • The function string.trimRight(" Hello World ", " ") returns Hello World.
  • The function string.trimRight("¡¡¡Hello, Gophers!!!", "!¡") returns ¡¡¡Hello, Gophers.