本文整理自网络,侵删。
身份证号码15到18位升位算法Delphi实现
function GetNewID(ID: string): string;
const
W: array[1..18] of Integer = (7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2, 1);
A: array[0..10] of Char = ('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
var
i, j, S: integer;
NewID: string;
begin
if Length(ID) <> 15 then
result := ''
else
begin
NewID := ID;
Insert('19', NewID, 7);
S := 0;
try
for i := 1 to 17 do
begin
j := StrToInt(NewID[i]) * W[i];
S := S + j;
end;
except
result := '';
exit;
end;
S := S mod 11;
Result := NewID + A[S];
end;
end;
相关阅读 >>
Delphi xe5也可以开发 google glass应用
Delphi f1026 file not found: ''quickrpt.dcu''解决方法
Delphi xe 网上获取北京时间android app 启动黑屏优化补丁
Delphi win7,win2008,win2003,winxp 屏蔽ctrl+alt+del
Delphi中inputbox 和inputquery 函数的使用
Delphi 使用 idhttp 获取 utf-8 编码的中文网页
更多相关阅读请进入《Delphi》频道 >>