LEFT$
BASIC keyword | |
Keyword: | LEFT$ |
Abbreviation: | L, E, Shift+F |
Type: | Function |
Token code: | 200/$C8 |
Handling routine in BASIC ROM: |
46848–46891 $B700–B72B |
List of all BASIC keywords |
Remark: This article describes the BASIC function LEFT$ in BASIC V2 at the Commodore 64.
Typ: String Function General Programming-Syntax: LEFT$(<string>,<integer number>)
LEFT$ is used for cutting strings into component parts beginning at the left side moving right 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 to 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$=LEFT$(A$,8): PRINT B$ (SATURDAY will be cutting and print out)
10 A$="SATURDAY MORNING" 20 FOR X=0 TO LEN(A$)+1 30 PRINT LEFT$(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