International Bank Account Number
From Free Pascal wiki
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 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;