System.SysUtils.TStringHelper.GetHashCode
Delphi
function GetHashCode: Integer;
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | System.SysUtils.pas | System.SysUtils | TStringHelper |
Description
Returns the hash code for this string.
Note: If two strings are equal, this method returns identical values. However, there is not a unique hash code for each particular string value. Different strings can return the same hash code.
Since RAD Studio Sydney the TStringHelper.GetHashCode member no longer creates an uppercase version of the string before calculating the hashcode.
Therefore, strings that differ only in case will produce different hash codes. To illustrate:
if 'Hello'.GetHashCode = 'HELLO'.GetHashCode then
ShowMessage('True')
else
ShowMessage('False');
The above showed the 'True' message in earlier versions. Starting RAD Studio Sydney, it shows 'False'.