String module

trim

procedureSource

s without the chars at either end; the result points into s.

trim :: (s: string, chars := DEFAULT_SPACES) -> string

Parameters

s: string
chars := DEFAULT_SPACES
the bytes to cut off, as a string of them: whitespace by default.

Returns

string
Example↗
assert(trim("  hi \t") == "hi");
assert(trim("--x--", "-") == "x");

See also