LTRIM$ function

Purpose:

LTRIM$ returns a substring of a string trimmed of the following leading characters

and, optionally trimmed, along with all the above characters, of all instances of a leading character specified in the optional CharToTrim parameter.

Syntax:

SubStr = LTRIM$(MainStr AS STRING [, CharToTrim AS INTEGER])

Return Value:

  • Data type: STRING
    SubStr MainStr$ string trimmed of the leading characters.

Parameters:

  • Data type: STRING
    MainStr String to be trimmed of the following leading characters
    • ASCII code point 9 CHARACTER TABULATION
    • ASCII code point 10 LINE FEED
    • ASCII code point 11 LINE TABULATION
    • ASCII code point 12 FORM FEED
    • ASCII code point 13 CARRIAGE RETURN
    • ASCII code point 32 SPACE
  • Data type: INTEGER
    CharToTrim [OPTIONAL] Windows Code Page code point integer of the leading character(s) which will be trimmed, along with all the above characters.

Example 1:

DIM AddStr$
DIM SubStr$
AddStr$ = "890"
SubStr$ = LTRIM$("    1234567") & AddStr$
PRINT SubStr$

Result:

1234567890

Example 2:

DIM AddStr$
DIM SubStr$
AddStr$ = "890"
SubStr$ = LTRIM$("Z    1234567", 90) & AddStr$
PRINT SubStr$

Result:

1234567890

BCX Console Sample Programs using the LTRIM$ function.