Difference between revisions of "ISO 7064/fr"

From Lazarus wiki
Jump to navigationJump to search
m
m (Fix typo)
 
(One intermediate revision by the same user not shown)
Line 7: Line 7:
 
La fonction StrMOD97 peut encoder et vérifier la somme de contrôle selon ISO 7064 mode 97 10.
 
La fonction StrMOD97 peut encoder et vérifier la somme de contrôle selon ISO 7064 mode 97 10.
  
<syntaxhighlight>
+
<syntaxhighlight lang=pascal>
  
 
function StrMOD97( s :String):integer;
 
function StrMOD97( s :String):integer;
Line 34: Line 34:
  
 
</syntaxhighlight>
 
</syntaxhighlight>
<br>
 

Latest revision as of 08:13, 18 February 2020

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;