InstrRev - Built-in String Function¶
Purpose¶
InStrRev returns the starting position of the last occurrence of one string within another.
Syntax¶
InStrRev(str1, str2 [,int] [,bool])
Arguments¶
| Argument | Required | Description |
|---|---|---|
str1 |
Yes | Any valid string expression. The string expression being searched. |
str2 |
Yes | Any valid string expression containing the expression being searched for. |
int |
No | Any valid integer expression containing the starting position for each search. |
bool |
No | Any valid Boolean expression indicating if the search is case insensitive. |
Returns¶
Variant with an integer (VT_I4 or VT_I8) value
Example¶
// Example case sensitive search:
Let iPos = InStrRev("AbraCadaBra","A",5)
Return iPos // returns 1
// Example case insensitive search:
Let iPos = InStrRev("AbraCadaBra","A",5, true)
Return iPos // returns 6
See Also¶
Notes¶
- When the arguments cannot be converted to the specified type, a runtime error is generated.
- If
intis omitted, the search will begin with the last character. - If
intis larger than the length ofstr1, the result will be 0, indicating nothing found. intis a zero-based index (zero or -1 means start from the last character).- If
boolis omitted, the search will be case-sensitive. - If
str2is not found, the function returns 0.