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 datamodule1 fdconnection1数据库连接

Delphi弹出信息框大全

Delphi指针

Delphi 随鼠标移动的十字线的快速画法

Delphi 获取其他进程句柄的几种方法

Delphi idhttp post 提交 json

Delphi xe5 为android增加启动图片显示

解决 Delphi 程序在不同操作系统中 shellexecute 调用 chrome.exe 偶尔无效的问题

Delphi 内存中加载dll

Delphi 让scrollbox响应鼠标滚轮事件

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



打赏

取消

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

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

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

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

评论

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