FindInSortedVector

Declaration: TVector.FindInSortedVector (Ascending: boolean; Value: double): integer;
The function FindInSortedVector searches the sorted vector for the element which is closest to Value and returns the index of the found element as the function value. The parameter Ascending indicates the sort order of the vector elements (TRUE = ascending, FALSE = descending).

Hint: As opposed to Find, the search algorithm in FindInSortedVector is based on a binary search, which is considerably faster, but which requires the vector to be sorted. If the vector elements are not sorted or not sorted according to the parameter Ascending, the search will not succeed, even if there is a matching cell in the vector.