EasyManua.ls Logo

Husky Hunter - Page 224

Husky Hunter
499 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
BASIC FUNCTIONS SECTION 5, 10
INSTR
5. 10, 10 Function INSTR searches for the occurrence of one string in another,
and returns wi.th the position of the first match,
Syntax Y = INSTR ([X)A$,B$) 1<X<255
Example 10 A$ = "BASICS"
20 PRINT INSTR(A$,"S")
This program will print 3, since this is the first
occurrence of the letter S.
10 A$
= "SUPER BASICS"
20 B$
= "SI"
30 PRINT INSTR(A$,B$)
This program will print 9 as the first occurrence of SI.
10 A$
= "BASICS"
20 PRil~T INSTR ( 4 ,A$, "S")
The above program will print 6, since this is the first
occurrence of the letter S from the fourth character on-
wards in the string A$.
Remarks If B$ does not occur in A$, then O is returned. X, which
is optional and defaults to 1, is used to start the search
at a particular place within a string.
Case is also important, i.e. "s" is not the same as
11
S
11
VER.V09F
PAGE 5 - 55