delphi 15位身份证号码转18位身份证号码


本文整理自网络,侵删。

 //15位身份证转18位身份证 
//仅供参考 
Function GetIDCard(AiIDCard : String) : String; 
Const 
IDCardGene : Array[1..18] Of Integer = (7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2,1); 
IDCardParity : Array[0..10] Of Char = ('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'); 
ValidLen = 15; 
Var 
sIDCard : String; 
i, s : Integer; 
Begin 
Result := ''; 
s := 0; 
sIDCard := Trim(AiIDCard); 
If(Length(sIDCard)=ValidLen)Then 
Begin 
Insert('19', sIDCard, 7); 
For i := 1 To ValidLen+2 Do 
Begin 
s := s + StrToInt(sIDCard[i]) * IDCardGene[i]; 
End; 
Result := sIDCard + IDCardParity[(s Mod 11)] 
End; 
End; 

相关阅读 >>

Delphi qq表情的实现

Delphi中sendmessage给一个edit控件发送wm_settext消息

Delphi xe8 为image设置渐变效果

Delphi 窗体置顶(总在最前面)

Delphi “invalid floating point operation.”错误的解决方法

Delphi 中压缩流和解压流的应用

Delphi ansicontainstext 是否包含子串

Delphi 实现窗体倒计时进度条显示

Delphi rs232c串行通讯接口的应用

Delphi winapi: writeprivateprofilestring、getprivateprofilestring - 简单读写 ini 文件

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



打赏

取消

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

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

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

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

评论

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