CheckMod10

 

Purpose:

Calculates the modulo 10 checksum digit of the string. A special function with the weight values "{ 0, 9, 4, 6, 8, 2, 7, 1, 3, 5 }" for the corresponding digits. This is used in some barcodes.

Parameter:

String   A string of digits.

String   optional: Weighting of digits. Default: '1' (same weight for all digits).

Return value:

Number

Example:

CheckMod10("03600024145")         Result: 7

CheckMod10("03600024145","41")  Result: 3 (for weight 4-1)