objarray : search

objarray search ?-sorted? <obj> <value>

Search the index of an item in the array. returns -1 if it is not found.

(if array is sorted it performs a faster binary search).

e.g.

set obj [objarray new_from_to intarray 2 5]
-> 2 3 4 5
objarray search -sorted $obj 4
-> 2