Find - Array

Member of: All Arrays

Locates a particular value inside an array and returns the index

SyntaxEdit

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

ParametersEdit

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

Return ValueEdit

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

ExamplesEdit

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


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 AlsoEdit