STR$

From C64-Wiki
Jump to: navigation, search
BASIC keyword
Keyword: STR$
Abbreviation: S, T, Shift+R
Type: Function
Token code: 196/$C4
Handling routine
in BASIC ROM:
46181–46214
$B465–B486
List of all BASIC keywords


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

Typ: String Function 
General Programming-Syntax: STR$(<numerical>)

STR$ will be used for converting numerical values or varibales into a string. When the number is positive or 0, the first char is a space. By negative numbers is the first char minus (-).

By using a wrong type of variable (also no floating point or integer variable) the BASIC-error ?TYPE MISMATCH ERROR in line appears. It can be used numbers inside the range of +/- 1e+38 or floating numbers with maximal 9 decimal places inside the range +/- 1e+28, by overrange the BASIC-error ?OVERFLOW ERROR IN line occurr. When the numerical argument is missing, the BASIC-error ?SYNTAX ERROR IN line is viewed.

Examples[edit]

PRINT STR$(1E11) (On screen: 1E+11)
PRINT STR$(0) (On screen: 0)
PRINT STR$(-1000) (On screen:-1000)
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