string.lstrip
Returns str with white-space characters removed from the beginning only.
Parameters
str | string | the 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
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
strip | Returns str with white-space characters removed from both ends. |
rstrip | Returns str with white-space characters removed from the end only. |
| string | module index |