RIGHT$

From C64-Wiki
Jump to: navigation, search
BASIC keyword
Keyword: RIGHT$
Abbreviation: R, Shift+I
Type: Function
Token code: 201/$C9
Handling routine
in BASIC ROM:
46829–46902
$B72C–B736
List of all BASIC keywords


Remark: This article describes the BASIC function RIGHT$ in BASIC V2 at the Commodore 64.

Typ: String Function 
General Programming-Syntax: RIGHT$(<string>,<integer number>)

RIGHT$ will be used for cutting strings into component parts beginning at the right side until to the left side. The indicated integer number takes the maximal numbers of chars. When we numerical value is 0, the outcome is a empty string (for example A$=""). When we indicated number is greater than the string, nothing will be cut.

The range of numerical values are 0 until 255. Outside the range - also negative or greater than 255 - the BASIC-error ?ILLEGAL QUANTITY ERROR IN line occurr. By using a wrong type of variable the BASIC-error ?TYPE MISMATCH ERROR in line appears. When the string or the numerical argument is missing, the BASIC-error ?SYNTAX ERROR IN line is viewed.


Examples[edit]

10 A$="SATURDAY MORNING"
20 B$=RIGHT$(A$,7): PRINT B$ (MORNING is cutting and print out)


10 A$="SATURDAY MORNING"
20 FOR X=0 TO LEN(A$)+1 
30 PRINT RIGHT$(A$,X): NEXT X
BASIC V2.0 (second release) Commands

ABS | AND | ASC | ATN | CHR$ | CLOSE | CLR | CMD | CONT | COS | DATA | DEF | DIM | END | EXP | FN | FOR | FRE | GET | GET# | GOSUB | GOTO | IF | INPUT | INPUT# | INT | LEFT$ | LEN | LET | LIST | LOAD | LOG | MID$ | NEW | NEXT | NOT | ON | OPEN | OR | PEEK | POKE | POS | PRINT | PRINT# | READ | REM | RESTORE | RETURN | RIGHT$ | RND | RUN | SAVE | SGN | SIN | SPC | SQR | STATUS/ST | STEP | STOP | STR$ | SYS | TAB | TAN | THEN | TIME/TI | TIME$/TI$ | TO | USR | VAL | VERIFY | WAIT