String module

trim

procedure · 1 overloadSource

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
ExampleOpen in playground ↗
assert(trim("  hi \t") == "hi");
assert(trim("--x--", "-") == "x");

See also