Returns a number specifying the position of the first occurrence of one string within another.
Syntax
InStr ( [start,] string1, string2 [,compare] )
| Parameter | Description |
|---|---|
start | Optional character position to begin search in string1. The default value is 1. A position value of 1 indicates the very first character in the string. If omitted, search begins at first character in string1. |
string1 | String expression or literal string in which to search. |
string2 | String expression or literal string for which to search. |
compare | Optional search mode. Values: 0 for case sensitive, 1 for case insensitive. Default is case sensitive. |
Notes
If a matching string is not found, the return value is 0.
Example
InStr (5, "Year2000_promotional", "promotional", 1)
returns 10