Vector_firstUnset |
Homepage Containers |
Searches for the first occurrence of an unset element, and returns the index for this element.
foundAt := Vector_firstUnset(VectorObject, startIndex = 1)
| VectorObject | The Vector object to use for the current operation. |
| startIndex | The index to start searching from. If omitted, the search starts with the first item. |
The index for the first matching element, starting with startIndex.
If there is no such element, the function returns 0.
The function's return can be used as a quasi-boolean value; the statement if Vector_firstUnset(...) would be true if an element is found, and false otherwise.
If VectorObject is NULL (0 or blank), the empty string is returned, to indicate an error.
Index values start at 1 and "wrap".
Vector_indexOf, Vector_lastIndexOf, Vector_regexIndexOf
Vector_findMatch, Vector_findLastMatch
Vector_lastUnset, Vector_findObject
;Creates a new Vector with the default parameters. myVector := Vector_new() ;Creates some String objects aString1 := String_new("Value1") aString2 := String_new("Value2") aString3 := String_new("Value1") ;Adds the Strings to myVector Vector_add(myVector, aString1) Vector_add(myVector, aString2) Vector_add(myVector, aString3) if foundAt := Vector_firstUnset(myVector, 2) { ;foundAt contains the index for the element. MsgBox, % "The element at index " foundAt " is unset." } else { ;foundAt = 0 (i.e. not found) MsgBox, % "No unset element found." }