diff --git a/Operand.cpp b/Operand.cpp
index 72cd925..8916ab6 100644
--- a/Operand.cpp
+++ b/Operand.cpp
@@ -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")) {
diff --git a/tests/testexpr.jet b/tests/testexpr.jet
index 3ef780f..3cc7da4 100755
--- a/tests/testexpr.jet
+++ b/tests/testexpr.jet
@@ -8,4 +8,6 @@ $[test2]=10
$[lefty]=01234
$[righty]=56789
+
+$[trim]=this is a test