Algori...M11_006(3pm)

πŸ“¦
version 1.3.6 Β· 5 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

✨ 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:

  1. Beginning right all digits are weighted 6,3,7,9,10,5,8,4,2,1. 🫢
  2. The weighted digits are added. βž•
  3. The sum of step 2 is taken modulo 11. πŸ”’
  4. The checkdigit is 11 minus 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 $number consists 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 $number is 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 $number if $number has a valid check digit. πŸ¦‹

Return '' otherwise.

  • checkdigit($number) β€” Returns the check digits of $number if $number has 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