instr - find one string in another


v = instr([NumExpr,] StrExpr1, StrExpr2)


Instr returns the index into the StrExpr1 where the string StrExpr2 first occurs.  If NumExpr is given, StrExpr1 is examined beginning at character position NumExpr.  Otherwise, StrExpr1 is examined beginning at character position 1. 

NumExpr may be any numeric expression.  StrExpr1 and StrExpr2 may be any string expressions.  If NumExpr > len(StrExpr1), or if StrExpr1 is null, or if StrExpr2 cannot be found, instr returns 0.  If StrExpr2 is null, instr returns NumExpr (or 1 if NumExpr is not specified). 


The program
	x$ = "Basmark Corporation"
	y$ = "rat"
	print instr(x$, y$); instr(16, x$, y$)
	 14  0
since the first "rat" occurs at position 14 in string x$, and there is no "rat" at or after position 16. 


If NumExpr is less than 1, an "Illegal function call" error occurs. 

from The Basmark QuickBASIC Programmerís Manual by Lawrence Leinweber