![]() ![]() The nth list (1-indexed) contains country codes for countries having n-character IBANS. insert ( "VG", 24 ) end Iban_Code Testing: Count - 1 loop Ch := Temp ( I ) if Ch in ' 0 '.' 9 ' then Num := Integer ' Value ( Integer ' Image ( Num ) & Ch ) mod 97 else Num := ( Num * 100 + ( Character ' Pos ( Ch ) - Character ' Pos (' A ') + 10 )) mod 97 end if end loop return Num = 1 end Is_Legal begin Nations. 4 ) - compute remainder modulo 97 for I in Temp ' First. 2 )) /= Count - 1 then return False end if - move the 4 initial characters to the end Temp ( Temp ' First. Map function Is_Legal ( Iban : String ) return Boolean is Temp : String ( Iban ' Range ) := ( others => ' ' ) Count : Integer Ch : Character Num : Integer := 0 begin - remove blank spaces and check characters Count := Temp ' First for I in Iban ' Range loop case Iban ( I ) is when ' ' => null when ' a '.' z ' => Temp ( Count ) := To_Upper ( Iban ( I )) Count := Count + 1 when ' A '.' Z '|' 0 '.' 9 ' => Temp ( Count ) := Iban ( I ) Count := Count + 1 when others => return False end case end loop - check nation code and length if not Nations. ![]() 2 ) package String_Integer is new _Maps (Nation, Integer, , Equivalent_Keys => " =" ) Nations : String_Integer. ![]() With use with _Maps with package body Iban_Code is subtype Nation is String ( 1. validation is: #.’.format(account, valid_iban(account))) Validate the following fictitious IBAN: GB82 WEST 1234 5698 7654 32ĭetails of the algorithm can be found on the Wikipedia page. The check digits enable a sanity check of the bank account number to confirm its integrity even before submitting a transaction.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |