help files
Z505 | PasWiki | FUQ | Search | Main Docs | API Guide



[Overview][Constants][Types][Procedures and functions][Variables] Reference for unit 'objpas' (#rtl)

Hash

Create GNU Gettext hash value for a string

Declaration

Source position: objpas.pp line 80

function Hash(

  S: AnsiString

):LongWord;

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 function call.

Errors

None. In case the calculated hash value should be 0, the returned result will be -1.

See also

GetResourceStringHash

  

Return hash value of resource string

Example

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.

Notes

 No notes exist for this page yet. 





lufdoc, Powtils, fpc, freepascal, delphi, kylix, c/c++, mysql, cgi web framework docs, Z505