ISO 7064

From Free Pascal wiki
Revision as of 19:48, 20 November 2015 by Djzepi (talk | contribs) (Created page with "{{ISO 7064}} ISO 7064 specifies a set of check character systems capable of protecting strings against errors which occur when people copy or key data. == function StrMOD97 ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

English (en) français (fr)

ISO 7064 specifies a set of check character systems capable of protecting strings against errors which occur when people copy or key data.

function StrMOD97

The function StrMOD97 can encode and verify number checksum with ISO 7064 mod 97 10

function StrMOD97( s :String):integer;
const
  modu = 97;
var
  sx :String;
  isx,ic,p:Integer;
begin
   p := Length( s );
   while( p > 9 ) do
     begin
       sx := Copy( s, 1, 9 );
       Delete( s, 1, 9 );
       isx := StrToInt( sx );
       ic := isx mod modu;
       s := IntToStr( ic ) + s;
       p := Length( s );
     end;
   isx := StrToInt( s );
   if isx >= modu
     then ic := isx mod modu
     else ic := isx;
  result := ic;
end;