Returns the last m characters of a string expression.
Right[$](a$ [,m [,fillchar]])
a$ | : sexp |
m | : integer expression |
fillchar | : iexp or sexp |
Right$(a$,m) returns the last m characters of the string expression a$. If m is not given, the last character of a$ is returned. (m > 0 )
When m is greater than the number of characters in a$ (spaces and Chr$(0) are characters too!), the entire string is returned. When Right it takes a third parameter fillchar, it should specify the character to fill the excess charcters of the return value when the source string does not hold enough characters. The fillchar can be an ASCII value or a string containing the character to fill the string with.
Print Right$("Hello GFA", 5) // prints o GFA
Print Right$("Hello GFA", 20) // prints Hello GFA
Print Right$("Hello GFA", -1) // prints
Print Right$("Hello GFA", 16, ".") // prints .......Hello GFA
Without the optional $ character the function still returns a String data type and not a Variant.
String, Left$, LeftUntil, Mid$, RightUntil, SubStr
{Created by Sjouke Hamstra; Last updated: 18/12/2022 by James Gaite; Other Contributors: Jean-Marie Melanson}