|
Performs a binary search for "key" in "array". "array" must have been previously sorted.
callback is the name of a callback function with the following parameters:
The callback function should return the following:
Example:<MvASSIGN NAME = "l.array" INDEX = 1 VALUE = "wombat"> <MvASSIGN NAME = "l.array" INDEX = 2 VALUE = "badger"> <MvASSIGN NAME = "l.array" INDEX = 3 VALUE = "beaver"> <MvFUNCTION NAME = "SortSearch_Callback" PARAMETERS = "left var, right var, data var"> <MvIF EXPR = "{ l.left LT l.right }"> <MvFUNCTIONRETURN VALUE = -1> <MvELSEIF EXPR = "{ l.left GT l.right }"> <MvFUNCTIONRETURN VALUE = 1> </MvIF> <MvFUNCTIONRETURN VALUE = 0> </MvFUNCTION> <MvASSIGN NAME = "l.null" VALUE = "{ miva_array_sort( l.array, 'SortSearch_Callback', l.null ) }"> <MvASSIGN NAME = "l.wombat_pos" VALUE = "{ miva_array_binarysearch( 'wombat', l.array, 'SortSearch_Callback', l.null ) }"> |