RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TBaseArray.FindItem Method

Locates a value in a sorted array and indicates whether an element with that value already exists.

Pascal
function FindItem(var Index: Integer; var Value): Boolean;
C++
__fastcall Boolean FindItem(int Index,  Value);

Use FindItem to obtain the index in a sorted array where an element with the value Value should be added. If an element with the value Value already exists in the array, FindItem returns true. If none of the elements in the array have the value Value, FindItem returns false.  

The index where Value should appear is returned in the Index parameter. The value of Index is zero-based, where the first element has the index 0, the second element has the index 1, and so on.

Note: FindItem assumes the SortOrder property is TS_ASCENDING. For unsorted arrays, use the IndexOf method instead. For descending arrays, invert the CompareProc property before calling FindItem.
 

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!