International Bank Account Number

From Lazarus wiki
Revision as of 20:02, 20 November 2015 by Djzepi (talk | contribs) (Created page with "{{International Bank Account Number}} The International Bank Account Number (IBAN) is an international standard for numbering bank accounts. It is ISO 13616 standard. The IBA...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

English (en) suomi (fi) français (fr)

The International Bank Account Number (IBAN) is an international standard for numbering bank accounts. It is ISO 13616 standard. The IBAN consists of up to 34 alphanumeric characters, comprising a country code, two check digits and a detailed bank account-number.


The country code using ISO 3166-1 alpha-2. The check digits calculated according to ISO 7064 (MOD97-10)

Function IsValidIban

Function IsValidIban checks is International Bank Account Number valid. Function StrMOD97 you find here ISO_7064#Function StrMOD97

function ReplaceLetterWithNumbers ( a_char:char):string;
var
  i: integer;
begin
  i := ord( upcase( a_char ) ) - ord( 'A' ) + 10;
  result := IntToStr( i );
end;   

function IsValidIban( s:string): boolean;
var
  a_char: char;
  s1: string;
  i : integer;
begin
  s := DelSpace( s );
  s1 := copy( s, 1, 4);
  delete(s, 1, 4);
  a_char :=  s1[1];
  delete(s1, 1, 1);
  s := s + ReplaceLetterWithNumbers ( a_char ) ;
  a_char :=  s1[1];
  delete(s1, 1, 1);
  s := s + ReplaceLetterWithNumbers ( a_char ) ;
  s := s + s1;
  i := StrMOD97( s );
  Result := i = 1;
end;