InStr
The InStr function returns the position of the first occurrence of one string within another.
Syntax :
InStr([start,]string1,string2[,compare])
Parameters | Description |
---|---|
start | Optional. Specifies the starting position for each search. The search begins at the first character position (1) by default. This parameter is required if compare is specified. |
string1 | Required. The string to be searched. |
string2 | Required. The string expression to search for. |
Compare | Optional. Specifies the string comparison to use. Default is 0. Can have one of the following values : 0 - vbBinaryCompare- Performs a binary comparison. 1 - vbTextCompare - Perform a textual Comparison. |
Example :
i = InStr(" Test ","Test")
Result :
i=2