ISO 7064/fr

From Lazarus wiki
Revision as of 08:12, 18 February 2020 by Trev (talk | contribs) (Fixed syntax highlighting)
Jump to navigationJump to search

English (en) français (fr)

La norme ISO 7064 spécifie un ensemble de systèmes de caractères de contrôle capable de protéger des chaînes contre les erreurs de saisie.

Fonction StrMOD97

La fonction StrMOD97 peut encoder et vérifier la somme de contrôle selon ISO 7064 mode 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;