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

NAME

6       CheckDigits::M11_015 - compute check digits for ESR5 (CH)
7

SYNOPSIS

9         use Algorithm::CheckDigits;
10
11         $ustid = CheckDigits('esr5_ch');
12
13         if ($ustid->is_valid('050001000012000 241170032660178 10304')) {
14               # do something
15         }
16
17         $cn = $ustid->complete('0001000012000 241170032660178 10304');
18         # $cn = '050001000012000 241170032660178 10304'
19
20         $cd = $ustid->checkdigit('0001000012000 241170032660178 10304');
21         # $cd = '05'
22
23         $bn = $ustid->basenumber('050001000012000 241170032660178 10304');
24         # $bn = '0001000012000 241170032660178 10304';
25

DESCRIPTION

27   ALGORITHM
28       1.  Beginning right all digits are weighted with the repeating sequence
29           2, 3, 4, 5, 6, 7.
30
31       2.  The weighted digits are added.
32
33       3.  The sum from step 2 is taken modulo 11.
34
35       4.  The checkdigit is 11 minus the sum from step 3.  If the difference
36           is 11, the checkdigit is 00.
37
38   METHODS
39       is_valid($number)
40           Returns true only if $number consists solely of numbers (with or
41           without space between them) and the first two digits are valid
42           check digits according to the algorithm given above.
43
44           Returns false otherwise,
45
46       complete($number)
47           The check digit for $number is computed and inserted before the
48           $number.
49
50           Returns the complete number with check digit or '' if $number does
51           not consist solely of digits, spaces.
52
53       basenumber($number)
54           Returns the basenumber of $number if $number has a valid check
55           digit.
56
57           Return '' otherwise.
58
59       checkdigit($number)
60           Returns the check digits of $number if $number has valid check
61           digits.
62
63           Return '' otherwise.
64
65   EXPORT
66       None by default.
67

AUTHOR

69       Mathias Weidner, <mathias@weidner.in-bad-schmiedeberg.de>
70

SEE ALSO

72       perl, CheckDigits,
73       http://www.pruefziffernberechnung.de/E/Einzahlungsschein-CH.shtml
74       (german), http://www.sic.ch/de/dl_tkicch_dta.pdf, page 52 (german)
75
76
77
78perl v5.12.1                      2009-11-20           CheckDigits::M11_015(3)
Impressum