Created
November 6, 2009 01:53
-
-
Save eight/227608 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function m10w31(code: string): integer; | |
/** | |
Delphi版 モジュラス10ウエィト3のチェックデジット計算。 | |
*/ | |
var | |
i,w,sum: integer; | |
begin | |
w := 3; | |
sum := 0; | |
for i := length(code) downto 1 do | |
begin | |
sum := sum + strtoint(code[i]) * w; | |
if w = 3 then w := 1 | |
else w := 3; | |
end; | |
Result := sum mod 10; | |
if Result<>0 then Result := 10 - Result; | |
end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment