Numeric expression that evaluates to an integer indicating how many characters from the end of string to return or replace. Fractional numbers are truncated to an integer. If length is greater than or equal to the number of characters in string, the entire string is returned (or replaced). No padding is performed. For length=0, see below.

An expression that evaluates to a string. Specifies the value used to either replace or append. If length is 0, value is appended to the end of string. If length is greater than zero, value replaces the specified character(s) at the end of string.

To replace a substring from the end (right end) of string. The replacement substring may be the same length, longer, or shorter than the original substring. This uses the Right(string,length)=value syntax, with value>0.

Right(string,length) returns the rightmost character(s) of string. The substring is determined by counting length characters backwards from the end (right end) of the string. If length is 0 or a negative number, Right returns the empty string (""). If you specify a length greater than the length of string, the entire string is returned.

To determine the number of characters in string, use the Len function.

The Left function returns the specified number of characters from the beginning (left end) of a string. The Mid function returns the specified number of characters from a specified starting point within a string.

Examples

The following example uses the Right function to return the last seven characters of mystr, the last 99 characters (in this case, all of the characters), and the last 0 characters: