The [array->findposition] method searches the array for the parameter and returns an array of positions for those elements which match. Accepts a single parameter of any data type including matchers. Optionally accepts a integer which is the offset position to begin searching the array at.
If the array contains any pair values, only the first part of the pair is compared with the parameter of the [array->findposition] method.
If no elements in the array match the parameter to the [array->findposition] method, or the offset parameter is outside of the size of the array, then an empty array is returned.
array->findposition('search_term') array->findposition('search_term', offset)
Return the positions that 'John Doe' occurs at in an array of names
var( myNames = array('John Doe', 'Jane Doe', 'Wendy Buck', 'John Doe', 'Jim Stag') ) $myNames->findposition('John Doe')
Return the positions that John Doe occurs at in the array of name:position pairs after the first one.
var( myNames = array('John Doe' = 'President', 'Jane Doe' = 'Vice President', 'Wendy Buck' = 'Treasurer', 'John Doe' = 'Sales Manager', 'Jim Stag' = 'Accountant') ) $myNames->findposition('John Doe', 2)
Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.