Action
Returns the position of a sub string in a string.
Syntax
var = INSTR( start , string , substr )
var = INSTR( string , substr )
Remarks
Var |
Numeric variable that will be assigned with the position of the sub string in the string. Returns 0 when the sub string is not found. |
Start |
An optional numeric parameter that can be assigned with the first position where must be searched in the string. By default (when not used) the whole string is searched starting from position 1. |
String |
The string to search. |
Substr |
The search string. |
At the moment INSTR() works only with internal strings.
Support for external strings will be added too.
Difference with QB
No constants can be used for the string and sub string.
See also
None
Example
Dim S As String * 10 , Z As String * 5
Dim Bp As Byte
S = "This is a test"
Z = "is"
Bp = Instr(s , Z) : Print Bp 'should print 3
Bp = Instr(4 , S , Z) : Print Bp 'should print 6
End