Algori...M43_001(3pm)

๐Ÿ“ฆ
version 1.3.6 ยท 5 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

๐ŸŽ€ CheckDigits::M43_001 ๐ŸŽ€

okay bestie, so this is a User Contributed Perl Documentation page โ€” part of the Algorithm::CheckDigits family, section 3pm. It's literally the module that handles check digits for Code-39, and it's giving reliable. ๐Ÿ’…


๐Ÿ’– NAME ๐Ÿ’–

CheckDigits::M43_001 โ€” compute check digits for Code-39. that's it, that's the job. no cap.


โœจ SYNOPSIS โœจ

here's the whole vibe in code form, copy it exactly bestie:

use Algorithm::CheckDigits;

$c39 = CheckDigits('code_39');

if ($c39->is_valid('AB-123K')) {
      # do something
}

$cn = $c39->complete('AB-123');
# $cn = 'AB-123K'

$cd = $c39->checkdigit('AB-123K');
# $cd = 'K'

$bn = $c39->basenumber('AB-123K');
# $bn = 'AB-123'

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

๐ŸŒธ ALGORITHM ๐ŸŒธ

two steps, icon, no notes:

  1. First you replace every non-numeric letter with its respective value, and then the sum of all those numbers is computed. ๐Ÿงฎ
  2. The checkdigit is the sum from step 1, taken modulo 43. that's the whole โœจmagicโœจ.

๐Ÿ’œ 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 up there. ๐Ÿ‘‘

Returns false otherwise. rude but fair.

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. obviously. ๐Ÿ’€

๐Ÿ“ EXPORT ๐Ÿ“

None by default. nothing, zero, zilch. you get what you ask for, periodt.


๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

Mathias Weidner, "<mamawe@cpan.org>" โ€” literal legend, respect. ๐ŸŒˆ


๐Ÿ”ฅ SEE ALSO ๐Ÿ”ฅ

  • perl
  • CheckDigits
  • www.pruefziffernberechnung.de.

okay that's the whole thing bestie, you're fully caught up. go forth and validate those Code-39 barcodes, main character energy only. ๐Ÿ’–

perl v5.36.0 ยท 2022-10-13 โ€” that's the version and the date, mwah, bye ๐ŸŽ€๐Ÿ’…

๐Ÿ“ฆ where this page comes from