3 LTRIM$

This routine trims whitespace (spaces, tabs, carriage returns and line-feeds) from the start (left) of a string.

A%=3:CALL&4083,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:

DEFFN_LTRIM$(s$)LOCALA%:A%=3:CALL&4083,s$:=s$

You could then invoke it like this:

PRINT "<"+FN_LTRIM$("  Hello  ")+">"

which would output

<Hello  >

See Also