RTRIM$ function

Purpose:

RTRIM$ returns a substring of a string trimmed of the following trailing characters

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

Syntax:

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

Return Value:

  • Data type: STRING
    SubStr MainStr trimmed of the trailing characters.

Parameters:

  • Data type: STRING
    MainStr String to be trimmed of the following trailing 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

    and, optionally, trimmed of all instances of a trailing character specified in the optional CharToTrim parameter.

  • Data type: INTEGER
    CharToTrim [OPTIONAL] Windows Code Page code point integer of the trailing character(s) which will be trimmed, along with all the above characters.

Example 1:

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

Result:

1234567890

Example 2:

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

Result:

1234567890