BASIC-80

Functions

INSTR

The INSTR function searches for the first occurrence of the second given string within the first given string, and returns the first position of the second string as an ordinal number. The optional argument, an expression I greater than 0 and less than 255, starts the search at I characters. The INSTR function returns a 0 under three conditions: if I is greater than the length of the first string, if the second string can- not be found in the first string, or if the first string contains no characters.

INSTR ([I,] string expression, string expression)

10A$ = "RANDOM NUMBER SUBROUTINE"

20B$ = "R"

30PRINT INSTR(A$, B$)

40PRINT INSTR(3,A$, B$)

50END

RUN

Ok

INT

The INT function returns the largest integer value less than or equal to the specified expression. The sign of the returned value is the same as the sign of the specified expression.

INT(expression)

10INPUT A

20B = INT(A)

30PRINT A

40END

RUN

? 18.0427

OK RUN

? -234.98 -235

LEFT$

The string function .LEFT$(X$,I) evaluates the string X$ and returns the leftmost I characters. I is an integer in the range 0-255.

LEFT$ (string expression, expression)

10X$ = "WHITE, SMITH, JONES, BLACK, GREEN"

20Y$ = LEFT$(X$,11)

30PRINTX$

40PRINTY$ RUN

WHITE, SMITH, JONES, BLACK, GREEN WHITE, SMITH

Ok

7-7

Page 71
Image 71
Intel 9800758-02 manual Int, Instr, Left$