This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!
InStr Function
Returns a
Long specifying the position of the first occurrence of one string within another.
InStr([start, ]string1, string2[, compare])
Arguments
- start
- Optional. that sets the starting position for each search. If omitted, search begins at the first character position. The start argument is required if compare is specified.
- string1
- Required. being searched.
- string2
- Required. String expression sought.
- compare
- Optional. Specifies the type of . If compare is omitted, the Option Compare setting determines the type of comparison. Specify a valid LCID (LocaleID) to use locale-specific rules in the comparison.
Settings
The compare argument settings are:
Constant |
Value |
Description |
BinaryCompare |
0 |
Performs a binary comparison. |
TextCompare |
1 |
Performs a textual comparison. |
Return Values
If |
InStr returns |
string1 is zero-length |
0 |
string2 is zero-length |
start |
string2 is not found |
0 |
string2 is found within string1 |
Position at which match is found |
start > string2 |
0 |
See Also
Example
InStrRev Function | Option Compare Statement | StrComp Function