BASIC-80

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)
10
A$
=
"RANDOM
NUMBER
SUBROUTINE"
20
B$
=
"R"
30
PRINT INSTR(A$, B$)
40
PRINT INSTR(3,A$, B$)
50
END
RUN
1
13
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)
10 INPUT A
20
B = INT(A)
30
PRINT A
40
END
RUN
? 18.0427
18
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)
10
X$
=
"WHITE,
SMITH, JONES, BLACK,
GREEN"
20
Y$
= LEFT$(X$,11)
30
PRINTX$
40
PRINTY$
RUN
WHITE, SMITH, JONES, BLACK, GREEN
WHITE, SMITH
Ok
Functions
7-7