STRING::TRIM 1g 2023-11-12 laplante@plcb.ca GOWEB/STRING — Trim Characters from Both Ends


title: “STRING::TRIM” version: “1.0.0” date: 2023-11-12 author: “laplante@plcb.ca” section: “1g”

category: “GOWEB/STRING”

Name

string::trim Trim Characters from Both Ends

Synopsis

string::trim(expression[, cutset: string])
trim(expression[, cutset: string])

Description

The trim function removes characters from both the left and right sides of the given expression, based on the characters in cutset.


Examples

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"].

Author

laplante@plcb.ca

See Also


Version