string.trim

This function returns a part of the input string with all leading and trailing Unicode code points contained in the cutset removed.

Syntax

string.trim(str)

Arguments

Argument

Type

Description

str

string

Source string

Returns

Type

Description

string

String with all leading and trailing Unicode code points

Examples

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