Algori...M11_006(3pm)
β¨ NAME β¨
CheckDigits::M11_006 β bestie, this is the module that computes check digits for the Codigo de Cuenta Corriente (ES) π
(yes it lives in User Contributed Perl Documentation β perl v5.36.0, page dated 2022-10-13, keep scrolling for the cute sign-off π)
πΈ SYNOPSIS πΈ
okay so real quick, here's the vibe:
use Algorithm::CheckDigits;
$ccc = CheckDigits('ccc_es');
if ($ccc->is_valid('2420-0730-27-0050103552')) {
# do something
}
$cn = $ccc->complete('2420-0730- -0050103552');
# $cn = '2420-0730-27-0050103552'
$cd = $ccc->checkdigit('2420-0730-27-0050103552');
# $cd = '27'
$bn = $ccc->basenumber('2420-0730-27-0050103552');
# $bn = '2420-0730- -0050103552';
likeβ¦ it validates, it completes, it extracts the check digit, it hands you the base number back. she does it all, no cap π
π§ DESCRIPTION π§
π ALGORITHM π
the math, step by step, stay with me:
- Beginning right all digits are weighted
6,3,7,9,10,5,8,4,2,1. π«Ά - The weighted digits are added. β
- The sum of step 2 is taken modulo 11. π’
- The checkdigit is
11minus the sum from step 3.
If the difference is 10, the checkdigit is 1.
If the difference is 11, the checkdigit is 0.
π METHODS π
is_valid($number)β Returns true only if$numberconsists solely of numbers and hyphens and the two digits in the middle are valid check digits according to the algorithm given above. β¨
Returns false otherwise,
complete($number)β The check digit for$numberis computed and inserted into the middle of$number. π
Returns the complete number with check digit or '' if $number does not consist solely of digits, hyphens and spaces.
basenumber($number)β Returns the basenumber of$numberif$numberhas a valid check digit. π¦
Return '' otherwise.
checkdigit($number)β Returns the check digits of$numberif$numberhas valid check digits. π
Return '' otherwise.
β EXPORT β
None by default. not a single thing, she's low maintenance fr fr π
π AUTHOR π
Mathias Weidner, "<mamawe@cpan.org>" π
π₯ SEE ALSO π₯
perl, CheckDigits, www.pruefziffernberechnung.de,
and that's the whole page bestie, mwah π β this was perl v5.36.0, dated 2022-10-13, filed under Algori...M11_006(3pm). slay, go validate some Spanish bank account numbers π¦β¨
π¦ where this page comes from
- ubuntu noble: libalgorithm-checkdigits-perl 1.3.6-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libalgorithm-checkdigits-perl 1.3.6-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libalgorithm-checkdigits-perl 1.3.6-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms