Description
Searches for a piece of text within another piece of text and returns the start position if found.
Syntax
InStr(<texttosearch>,<texttofind>,[index])
Arguments
Argument | Type | Description | Optional |
---|---|---|---|
texttosearch | text | Specifies the text value to be searched | No |
texttofind | text | Specifies the text to find within texttosearch | No |
index | number | Specifies which item to return if texttofind is found multiple times | Yes |
Returns
Returns a number specifying the start position of the first occurrence of one string within another.
The number is a one-based index if a match is found. If no match is found, the function returns zero.
Examples
Expression: | InStr("The green mile", "green") |
Returns: | 5 |
Expression: | InStr("I do not like green eggs and ham. I do not like them, Sam-I-Am.", "like", 2) |
Returns: | 44 |