RFind - Array
Jump to navigation
Jump to search
Member of: All Arrays
Locates a particular value inside an array and returns the index, starting from the end of the array, and moving to the beginning.
Syntax[edit | edit source]
int Function RFind(;/element type/; akElement, int aiStartIndex = -1) native
Parameters[edit | edit source]
- akElement: The element to locate
- aiStartIndex: Where to start the search. If this is -1 it starts at the end of the array.
- Default: -1
Return Value[edit | edit source]
The index of the item in the array, or a negative value if it was not found.
Examples[edit | edit source]
if (MyIntArray.RFind(1) < 0)
Debug.Trace("Did not find 1 in the array")
endIf
int firstPosition = MyStringArray.RFind("Hello")
Debug.Trace("The last Hello is at position " + firstPosition)
int secondPosition = MyStringArray.RFind("Hello", firstPosition - 1)
Debug.Trace("Found second to last Hello at position " + secondPosition)