GLBasic User Manual

Main sections

INSTR()

pos% = INSTR(word$, find$, start%=0)



INSTR searches the string word$ to see if it contains the string find$. The value returned is the position within word$ where the first instance of find$ is found (the index of the first character in the string = 0). If the substring find$ does not exist in word$, -1 is returned.

The optional parameter start% specifies the start position to search. The default value for this is 0, so unless otherwise specified the search begins at the first character.


pos = INSTR("Dream Design", "sign")
PRINT pos, 0,0
SHOWSCREEN
MOUSEWAIT


Output:
8

See also...