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 解决idtcpclient和idtcpserver通信中文乱码问题

Delphi手动创建dataset并插入值

Delphi 解析Delphi中的loadlibrary,getprocaddress,freelibrary

Delphi 字符串变形替换

Delphi 获取分解时间日期的年月日

Delphi memo 字符串换行

Delphi shellexecute 打开文件夹

Delphi 比较俩组ip地址是否一样

sqlite报错database is locked的解决办法

Delphi写入txt

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



打赏

取消

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

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

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

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

评论

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