The Find attribute function determines at which index a value is represented in the list. It returns the lowest index of first occurrence.
Syntax | ||||
Find(Value, [UseTextCompare]) | ||||
Return value | ||||
Type |
Description | |||
Long |
Index position of the found value or -1 for value not found | |||
Parameter | ||||
Use |
Name |
Type |
Passing |
Description |
Required |
Value |
Variant |
ByVal |
The item that must be searched in the list |
Optional |
UseTextCompare |
Boolean |
ByVal |
Specifies whether to search for binary (default) or text content |
Example:
Colors.Add({"red", "blue", "green", "brown", "yellow"})
MsgBox(Colors.Find("green"))
#Shows 2
MsgBox(Colors.Find("GREEN"))
#Shows -1
MsgBox(Colors.Find("GREEN", True))
#Shows 2