Find - Array

From Creation Kit
Jump to: navigation, search

Member of: All Arrays

Locates a particular value inside an array and returns the index


int Function Find(;/element type/; akElement, int aiStartIndex = 0) native


  • akElement: The element to locate
  • aiStartIndex: Where to start the search
    • Default: 0

Return Value

The index of the item in the array, or a negative value if it was not found.


if (MyIntArray.Find(1) < 0)
  Debug.Trace("Did not find 1 in the array")

int firstPosition = MyStringArray.Find("Hello")
Debug.Trace("Found Hello at position " + firstPosition)
int secondPosition = MyStringArray.Find("Hello", firstPosition + 1)
Debug.Trace("Found a second Hello at position " + secondPosition)

See Also