RIGHT$
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$ is used for cutting strings into component parts beginning at the right side moving left until the indicated integer number of characters has been reached. The indicated integer number specifies the maximum number of characters to include. When the numerical value is 0, the outcome is an empty string (for example A$=""). When the 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 occur. 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 | edit source]
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
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