[Overview][Types][Classes][Index] |
Gets the ordinal position in List where the specified key (and data) are stored.
Source position: stringhashlist.pas line 63
public function TStringHashList.Find( |
const S: string |
):Integer; |
const S: string; |
Data: Pointer |
):Integer; |
S |
|
Key value for the hash item to locate in the List. |
Ordinal position for the requested hash item, or -1 when not found.
S |
|
Key value for the hash item to locate in the List. |
Data |
|
Untyped pointer to the optional data for the hash item. |
Find is an Integer function used to the position in List where the hash item with the specified Key value is stored. The return value contains the ordinal position for the hash item in List, or -1 when a hash item is not found for the key value in S.
S contains the key value for the hash item locates in the method. HashOf is called to get the 32-bit hash value, and BinarySearch is called to locate the hash value in List.
An overloaded variant provides an untyped pointer in Data that is also used to locate the hash item. If the value in Data does not match the stored value in List, other candidates with the same hash value are considered. A match is found when the Key and Data for the hash item are the same. Otherwise, the return value is set to -1 to indicate that a match was not found.
Find is used in the Remove method, and to implement indexed access for the Data property.
Version 4.0 | Generated 2025-05-03 | Home |