Delphi实现身份证号码15到18位升位算法


本文整理自网络,侵删。

 身份证号码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 firedac连接oracle

processid, process handle, window handle 之间的互相转换

模拟鼠标点击 查找窗口标题

Delphi fmx窗体中控件对齐方式介绍

Delphi 比较两个日期相差天数

indy tidtcpclient 在网络掉线时的处理方法

Delphi中datetimepicker组件介绍

Delphi 模仿qq截图

Delphi 权限控制(Delphi tactionlist方案)

Delphi ntfs usn 磁盘文件搜索

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...