RIGHT()

RIGHT()

Top  Previous  Next

 

The RIGHT() function returns the trailing part of a string.

 

 

Format

 

RIGHT(string, len)

 

where

 

stringis the string from which the leading substring is to be extracted.

 

lenis the length of the substring to be extracted. A value less than zero is replaced by zero.

 

 

The RIGHT() function returns the rightmost length characters from the given string. If length is greater than the number of characters in the string, the entire string is returned.

 

This function is identical in effect to use of the rightmost substring assignment operator. Thus the following two statements are equivalent:

SUBSTR = RIGHT(VAR, length)

SUBSTR = VAR[length]

 

 

 

Example

 

A = "ABCDEFGHIJK"

S = RIGHT(A, 3)

 

This program fragment assigns the string "IJK" to variable S.

 

 

See also:

LEFT()