Quirrel4.41.0

string.lstrip

Defined in module "string"
from "string" import lstrip
pure fastcall lstrip(str: string): string

Returns str with white-space characters removed from the beginning only.

Parameters

strstringthe string to trim

Return value

A new string with the leading white space removed; trailing white space, if any, is kept.

Notes

See strip for exactly which characters count as white space.

Example

examples/string/lstrip.nut
from "string" import lstrip

println("lstrip(\"  hi  \") =", $"[{lstrip("  hi  ")}]")

// nothing at the front to strip: the string comes back unchanged
println("lstrip(\"hi\") =", $"[{lstrip("hi")}]")
Output:
lstrip("  hi  ") = [hi  ]
lstrip("hi") = [hi]

See also

stripReturns str with white-space characters removed from both ends.
rstripReturns str with white-space characters removed from the end only.
stringmodule index