Quirrel4.41.0

string.rstrip

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

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

Parameters

strstringthe string to trim

Return value

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

Notes

See strip for exactly which characters count as white space.

Example

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

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

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

See also

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