INSTR              ' VB style

#include <VBSTRING.bas>                        ' source in /Program Files/Coridium/BASIClib 

FUNCTION INSTR( startsearchee, lookfor )


This FUNCTION written in BASIC searches the string  searchee looking for the string lookfor, starting at the start-th character.

If it is found, the position of the first character of lookfor in searchee is returned, otherwise 0.

start is based on 1 being the first character, which is consistent with the InStr VB function, but inconsistent with the VB searchee.Chars(0) being the first character.  The C style STRSTR version of this routine uses 0 as the first character.


#include <VBSTRING.bas> 
DIM text(10)
text = "HELLO WORLD" 
PRINT INSTR(1, text, "LLO")     ' will display  3

Differences from other BASICs

See also