REM
REM Contributed by James C. Fuller - April 2009.
REM
REM =======================================================
REM make sure ltrim and rtrim are included
REM INCLUDE ltrim
REM INCLUDE rtrim
REM =======================================================
FUNCTION Trim(STRING Main$,STRING Match$)
LOCAL mlen,mtlen TYPE int
LOCAL S1$ TYPE STRING
mlen = LEN(Match$)
mtlen = LEN(Match$)
IF (mlen EQ 0) OR (mtlen EQ 0) THEN
RETURN Match$
END IF
S1$ = LTrim(Main$,Match$)
S1$ = RTrim(S1$,Match$)
RETURN S1$
END FUNCTION
REM Test Trim
REM PRINT "ABC",Trim(" James ",CONCAT$(" ",CHR$(9))),"EFG" FORMAT "%s%s%s\n"