身份证号码校验位的计算方法

废话不多说,直接上主要函数:

function jy_sfzh(Str:string):char;
var
 r:integer;
 t_tmp:integer;
 jym:char;
begin
 if (isnum(copy(Str,1,17))=true) and (isdate(copy(Str,7,8))=true)  then
 begin
  t_tmp:=(strtoint(Str[1])*7
        +strtoint(Str[2])*9
        +strtoint(Str[3])*10
        +strtoint(Str[4])*5
        +strtoint(Str[5])*8
        +strtoint(Str[6])*4
        +strtoint(Str[7])*2
        +strtoint(Str[8])*1
        +strtoint(Str[9])*6
        +strtoint(Str[10])*3
        +strtoint(Str[11])*7
        +strtoint(Str[12])*9
        +strtoint(Str[13])*10
        +strtoint(Str[14])*5
        +strtoint(Str[15])*8
        +strtoint(Str[16])*4
        +strtoint(Str[17])*2) mod 11;
   case t_tmp of
    0: jym:='1';
    1: jym:='0';
    2: jym:='X';
    3: jym:='9';
    4: jym:='8';
    5: jym:='7';
    6: jym:='6';
    7: jym:='5';
    8: jym:='4';
    9: jym:='3';
    10: jym:='2';
   end;
   result:= jym;
 end
 else
  result:='N';
end;

完整源码下载

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值