RIGHT$()

RIGHT$(S,N)

RETURNS THE N LAST CHARACTERS OF THE STRING S

  • Type: Function
  • Parameters: 2
  • Group: Strings

ACTION

The function RIGHT$(S,N) returns the N last characters (on the right) of the string expression S.

N must not be negative. If N is 0, RIGHT$ returns the empty string ("").

Remark: the keyword RIGHT$ ends by '$' : it means that the returned value is a string.

SYNTAX: Result$=RIGHT$(S,N)

  • S = string expression.
  • N = number of characters to be extracted from the string S.
  • Result$ is a string.

USE

  • The function RIGHT$() is used to extract a string containing the last characters of a string.

ERROR

  • If S is not a correct string expression.
  • If N is not a correct expression.
  • If N is less than or equal to 0 or greater than 200.

EXAMPLE

print right$("abcd",2)

print "cd"

SEE ALSO

INSERT$()

INSTR()

LEFT$()

LEN()

LOWER$()

LTRIM$()

MID$()

RTRIM$()

STR$()

STRING$()

TRIM$()

UPPER$()