Home > Language Reference > String Management Functions > Right$

Right$

The Right$ function returns the specified number of rightmost characters from a string.

Usage

Used to extract the right part of a string.  

Syntax

var$=Right$(<source_string>, <length>)

Parameters

<source_string>, string from which the rightmost characters have to be returned.

<length>, integer, number of characters to return. 

Return value

var$, string, result of the extraction. If <length> is negative or 0, the function returns an empty string (an empty string is ""). If <length> is greater than or equal to the number of characters of <source_string>, the entire string is returned.

See also

Asc
Chr$
Encrypt
ExtractBetween$
InStr
InStrRev
LCase$
Left$
Len
LTrim$
Mid$
Replace$
RTrim$
SplitIntoArray
Str$
Trim$
UCase$
Val

Examples

a$ = Right$("example",3) ' Returns "ple" in a$

a$ = Right$("example",0) ' Returns "" in a$