Difference between revisions of "International Bank Account Number"

From Lazarus wiki
Jump to navigationJump to search
(insert →‎See Also: Rosetta Code)
m
Line 6: Line 6:
  
 
The country code using ISO 3166-1 alpha-2.
 
The country code using ISO 3166-1 alpha-2.
The check digits are calculated according to [[ISO 7064]] (MOD97-10) using [[ISO_7064#Function StrMOD97|StrMOD97]]  
+
The check digits are calculated according to [[ISO 7064]] (MOD97-10) using [[ISO_7064#Function StrMOD97|StrMOD97]].
  
 
== Function IsValidIBAN ==
 
== Function IsValidIBAN ==

Revision as of 20:24, 28 November 2021

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 are calculated according to ISO 7064 (MOD97-10) using StrMOD97.

Function IsValidIBAN

Function IsValidIBAN() checks if an IBAN is valid.

function IsValidIBAN( s: string ): boolean;

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

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;

See Also

  • IBAN on RosettaCode.org