The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



FindCellInSortedColumn


Unit:SDL_dstruct
Class:TStringArray
Declaration:function FindCellInSortedColumn (FindStr: string; MatchCase: boolean; ColIx, RowLow, RowHigh: longint; ColIsAscending: boolean; var row: longint): boolean;

The method FindCellInSortedColumn searches for the occurrence of the string FindStr in the sorted column ColIdx. The parameter ColIsAscending indicates the sort order of the column elements (TRUE = ascending, FALSE = descending). The parameter MatchCase determines whether upper and lower cases are ignored (FALSE) or used (TRUE) during the search. The parameters RowLow and RowHigh define the search range. The valid range for ColIx is 0..NrOfColumns, and for RowLow and RowHigh is 1..NrOfRows. In order to include an entire column into the search range, the values for RowLow and RowHigh have both to be set to a value of -1.

If the search is successful FindCellInSortedColumn returns TRUE. In this case the variable parameter Row contains the coordinates of the found string. If the search string has not been found, the parameter Row points to the row above or below the string which comes closest to the search string.

Hint: As opposed to FindCell, the search algorithm in FindCellInSortedColumn is based on a binary search, which is considerably faster, but which requires the column ColIx to be sorted. If the column elements are not sorted or not sorted according to the parameter ColIsAscending, the search will not succeed, even if there is a matching cell in the array.


Last Update: 2012-Oct-20