STRING::TRIM
1g 2023-11-12 laplante@plcb.ca GOWEB/STRING — Trim Characters from Both Endstitle: “STRING::TRIM” version: “1.0.0” date: 2023-11-12 author: “laplante@plcb.ca” section: “1g”
string::trim Trim Characters from Both Ends
string::trim(expression[, cutset: string])
trim(expression[, cutset: string])
The trim
function removes characters from both the left and right sides of the given expression
, based on the characters in cutset
.
cutset
: " \t\n\v"
(spaces, tabs, newlines, vertical tabs)cutset
is provided, trimming will be performed using those characters only.res={{
trim(" hello "); ".\n";
trim(" Pierre Laplante "); ".\n";
a := "\n\nabc\n\n";
trim(a); ".\n";
a = "3223987diufhwrifuh23892938472";
trim(a, cutset:"1234567890"); "\n";
a = [ "a ", "\nb\n", "\tc\t", "\vd\v\v"];
b := " abc ";
trim(a,b); ".\n";
}}.
Returns:
hello.
Pierre Laplante.
abc.
diufhwrifuh
[["a","b","c","d"],"abc"].
laplante@plcb.ca