1CheckDigits::M97_002(3)User Contributed Perl DocumentatioCnheckDigits::M97_002(3)
2
3
4

NAME

6       CheckDigits::M97_002 - compute check digits for International Bank
7       Account Number (IBAN)
8

SYNOPSIS

10         use Algorithm::CheckDigits;
11
12         $iban = CheckDigits('iban');
13
14         if ($iban->is_valid('DE88 2008 0000 09703 7570 0')) {
15               # do something
16         }
17
18         $cn = $iban->complete('DE00 2008 0000 09703 7570 0');
19         # $cn = 'DE88 2008 0000 09703 7570 0'
20
21         $cd = $iban->checkdigit('DE88 2008 0000 09703 7570 0');
22         # $cd = '88'
23
24         $bn = $iban->basenumber('DE88 2008 0000 09703 7570 0');
25         # $bn = 'DE00 2008 0000 09703 7570 0'
26

DESCRIPTION

28   ALGORITHM
29       0   The IBAN number must be prepared. The first two letters and the
30           checksum will be moved to the right end. The letters are
31           substituted according to the substitute table and the checksum is
32           set to '00'.
33
34       1   The whole number is taken modulo 97.
35
36       2   The checksum is difference between 98 and the sum of step 2.
37
38       3   If the checksum is smaller then 10, a leading zero will be
39           prepended.
40
41   METHODS
42       is_valid($number)
43           Returns true only if $number consists solely of numbers and the
44           last digit is a valid check digit according to the algorithm given
45           above.
46
47           Returns false otherwise,
48
49       complete($number)
50           The check digit for $number is computed and concatenated to the end
51           of $number.
52
53           Returns the complete number with check digit or '' if $number does
54           not consist solely of digits and spaces.
55
56       basenumber($number)
57           Returns the basenumber of $number if $number has a valid check
58           digit.
59
60           Return '' otherwise.
61
62       checkdigit($number)
63           Returns the checkdigits of $number if $number has a valid check
64           digit.
65
66           Return '' otherwise.
67
68   EXPORT
69       None by default.
70

AUTHOR

72       Mathias Weidner, <mathias@weidner.in-bad-schmiedeberg.de>
73

THANKS

75       Detlef Pilzecker pointed out to me that there may be more letters as
76       the first two in an IBAN number. He also made me aware of a faster
77       method to compute the check number than using Math::BigInt.
78

SEE ALSO

80       perl, CheckDigits, www.pruefziffernberechnung.de,
81       www.sic.ch/en/tkicch_home/tkicch_standardization/tkicch_financialinstitutions_ibanipi.htm.
82
83
84
85perl v5.12.1                      2009-11-20           CheckDigits::M97_002(3)
Impressum