Algori...M10_006(3pm)

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

πŸ’– NAME πŸ’–

CheckDigits::M10_006 β€” bestie, this one computes check digits for the german Rentenversicherung (that's DE, Germany, no cap) ✨


🌸 SYNOPSIS 🌸

use Algorithm::CheckDigits;

$rv = CheckDigits('rentenversicherung');

if ($rv->is_valid('65180539W001')) {
      # do something
}

$cn = $rv->complete('65180539W00');
# $cn = '65180539W001'

$cd = $rv->checkdigit('65180539W001');
# $cd = '1'

$bn = $rv->basenumber('65180539W001');
# $bn = '65180539W00'

periodt, that's the whole vibe πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

✨ ALGORITHM ✨

okay so here's the tea, step by step, don't skip any of it:

  1. The letter gets replaced with a two-figure number appropriate to the position of the letter in the german alphabet. (yes, german alphabet, she's specific like that πŸ’…)
  2. Beginning left, all numbers are weighted with 2,1,2,5,7,1,2,1,2,1,2,1. These numbers are literally iconic, memorize them fr fr.
  3. The the total of the digits of all products is computed. (we said "the the" and we're keeping it, that's just how the original was feeling that day 😭)
  4. The check digit is sum from step 3 taken modulo 10. Math ate, lowkey. πŸ”₯

πŸ’œ METHODS πŸ’œ

is_valid($number)

Returns true only if $number consists solely of numbers and the last digit is a valid check digit according to the algorithm given above.

Returns false otherwise,

complete($number)

The check digit for $number is computed and concatenated to the end of $number.

Returns the complete number with check digit or '' if $number does not consist solely of digits and spaces.

basenumber($number)

Returns the basenumber of $number if $number has a valid check digit.

Return '' otherwise.

checkdigit($number)

Returns the checkdigit of $number if $number has a valid check digit.

Return '' otherwise.


πŸŽ€ EXPORT πŸŽ€

None by default. Yeah bestie, she gives you nothing for free πŸ™ˆ nothing is auto-exported, that's just the rules.


🌈 AUTHOR 🌈

Mathias Weidner, "<mamawe@cpan.org>" β€” shoutout to the icon who wrote this πŸ’–


⭐ SEE ALSO ⭐

perl, CheckDigits, www.pruefziffernberechnung.de.


and that's the whole page, bestie! this one was shipped with perl v5.36.0 back on 2022-10-13 β€” thank you for coming to my ted talk, slay, mwah πŸ’…πŸ’–βœ¨

πŸ“¦ where this page comes from