This routine trims whitespace (spaces, tabs, carriage returns and line-feeds) from the start (left) 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%=3:CALL&4083,str$
30 PRINT "<"+str$+">"

would output:

<Hello  >

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_LTRIM$("  Hello  ")+">"

which would output

<Hello  >

See Also