RTRIM$(string-expression)
Removes all trailing spaces from the end of the string expression and returns the result.
Examples
Produces "Hello".
PRINT RTRIM$("Retro Rocket ")
Produces "Retro Rocket" (only trailing spaces removed).
REM Trim before concatenating
a$ = "Name "
b$ = "Surname"
PRINT RTRIM$(a$) + " " + b$
Notes
- Only space characters (CHR$(32)) are removed; tabs and other whitespace are not affected.
- If the string has no trailing spaces, it is returned unchanged.
- Use LTRIM$ to remove leading spaces, or TRIM$ to remove both ends.
See also: LTRIM$ · TRIM$ · LEN