strings.rtrim

Supported in:
strings.rtrim(string_to_trim, cutset)

Description

Trims trailing white spaces from a given string. Removes trailing characters that are present in that cutset.

Param data types

STRING, STRING

Return type

STRING

Code samples

The following are example use cases.

Example 1

The following example passes the same string as the first and second argument.

strings.rtrim("str", "str") = ""
Example 2

The following example passes an empty string as the second argument.

strings.rtrim("str", "") = "str"
Example 3

The following example passes an empty string as the first argument and a non-empty string as the second argument.

strings.rtrim("", "str") = ""
Example 4

The following example passes a string containing white spaces as the first argument and a non-empty string as the second argument.

strings.rtrim("a aastraa aa ", " a") = "a aasstr"