RIGHT$

A string function which returns the right 'num' characters of the string. If there are insufficient characters in the string then all are returned.

There must not be any spaces between the RIGHT$ and the opening bracket.

A$=RIGHT$(A$,num)
A$=RIGHT$(A$,2)
A$=RIGHT$(LEFT$(A$,3),2)

For example,

10 name$="BBCBASIC(Z80)"
20 FOR i=3 TO 14
30   PRINT RIGHT$(name$,i)
40 NEXT
50 END

would print

80)
Z80)
(Z80)
C(Z80)
IC(Z80)
SIC(Z80)
ASIC(Z80)
BASIC(Z80)
CBASIC(Z80)
BCBASIC(Z80)
BBCBASIC(Z80)
BBCBASIC(Z80)

Syntax

<s-var>=RIGHT$(<str>,<numeric>)

Associated Keywords