indexOfItem

Full name: taxi.stdlib.indexOfItem

Signature

declare extension function <T> indexOfItem(collection:T[], searchItem: T):Int

Description

Returns the zero-based index of an item within a collection, or -1 if the item was not found.

find { playlist: Playlist } as {
   songPosition: Int = playlist.tracks.indexOfItem('Bohemian Rhapsody')
}

Examples

Returns the index of an item in the collection, or -1 if not found.

Try it out

Schema
Query Plan
Play with this snippet by editing it here, or edit it on Taxi Playground
Result
Query failed
Next
Welcome to Taxi