[next] [prev] [prev-tail] [tail] [up]

#### Hash

Declaration:
  Function Hash(S : AnsiString) : longint;
Description:
  Hash calculates the hash value of the string S in a manner that is compatible with the GNU gettext hash value for the string. It is the same value that is stored in the Resource string tables, and which can be retrieved with the GetResourceStringHash (604) function call.
Errors:
  None. In case the calculated hash value should be 0, the returned result will be -1.
See also:
  GetResourceStringHash (604),

Listing: refex/ex93.pp

Program Example93;
{ Program to demonstrate the Hash function. }
{$Mode Delphi}
ResourceString
First = 'First string';
Second = 'Second String';
Var I,J : Longint;
begin
For I:=0 to ResourceStringTableCount-1 do
For J:=0 to ResourceStringCount(i)-1 do
If Hash(GetResourceStringDefaultValue(I,J))
<>GetResourceStringHash(I,J) then
Writeln ('Hash mismatch at ',I,',',J)
else
Writeln ('Hash (',I,',',J,') matches.');
end.

[next] [prev] [prev-tail] [front] [up]