CheckMod10

Purpose:

Calculates the modulo 10 checksum digit of the string. A special function with the weight values "{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","946827135")         Result: 7

CheckMod10("03600024145","")   Result: 5 (weight 1)

CheckMod10("03600024145","1") Result: 5

CheckMod10("03600024145","41") Result: 3