added trim operand function.

This commit is contained in:
Brad Arant 2025-01-16 13:39:09 -08:00
parent f7812821b3
commit 5cefb0974b
2 changed files with 9 additions and 1 deletions

View File

@ -78,7 +78,13 @@ namespace jet {
} else
throw coreutils::Exception("Expecting ) at end of RIGHT expression.");
} else if(in.ifNextIgnoreCase("TRIM")) {
if(!in.ifNext("("))
throw coreutils::Exception("Expecting ( for TRIM parameters.");
Operand parm1(in, tag);
if(in.ifNext(")")) {
string = parm1.string.trim();
} else
throw coreutils::Exception("Expecting ) at end of TRIM expression.");
} else if(in.ifNextIgnoreCase("TOUPPER")) {
} else if(in.ifNextIgnoreCase("TOLOWER")) {

View File

@ -8,4 +8,6 @@ $[test2]=10
$[lefty]=01234
<set name="righty" expr="right($[numbers],5)" />
$[righty]=56789
<set name="trim" expr="trim(' this is a test ')" />
$[trim]=this is a test
</jet>