Skip to content

trim_start

Trims whitespace or specified characters from the start of a string.

trim_start(x:string, [chars:string]) -> string

The trim_start function removes characters from the beginning of x.

When called with one argument, it removes leading whitespace. When called with two arguments, it removes any characters found in chars from the start of the string.

The string to trim.

A string where each character represents a character to remove. Any character found in this string will be trimmed from the start.

Defaults to whitespace characters.

from {x: " hello".trim_start()}
{x: "hello"}
from {x: "/path/to/file".trim_start("/")}
{x: "path/to/file"}
from {x: "/-/hello".trim_start("/-")}
{x: "hello"}

trim, trim_end

Last updated: