Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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