This routine trims whitespace (spaces, tabs, carriage returns and line-feeds) from the start and end of a string.
All arguments are passed by reference. You may pass multiple strings at a time. Both movable strings and fixed strings are supported; all other types are ignored.
The following program:
10 str$=" Hello " 20 A%=5:CALL&4083,str$ 30 PRINT "<"+str$+">"
BASIC wrapper function
You can wrap up the routine as a standard BASIC function using the following snippet:
You could then invoke it like this:
PRINT "<"+FN_TRIM$(" Hello ")+">"
which would output