为了正常的体验网站,请在浏览器设置里面开启Javascript功能!

身份证格式验证(ID format validation)

2017-09-01 5页 doc 18KB 42阅读

用户头像

is_353097

暂无简介

举报
身份证格式验证(ID format validation)身份证格式验证(ID format validation) 身份证格式验证(ID format validation) which ccitycode: array [0..91] of string = ( '', '', '', '', '', '', '', '', '', '', '', '北京', '天津', '河北', '山西', '内蒙古', '', '', '', '', '', '辽宁', '吉林', '黑龙江', '', '', '', '', '', '', '', '上海', '江苏', ...
身份证格式验证(ID format validation)
身份证格式验证(ID format validation) 身份证格式验证(ID format validation) which ccitycode: array [0..91] of string = ( '', '', '', '', '', '', '', '', '', '', '', '北京', '天津', '河北', '山西', '内蒙古', '', '', '', '', '', '辽宁', '吉林', '黑龙江', '', '', '', '', '', '', '', '上海', '江苏', '浙江', '安微', '福建', '江西', '山东', '', '', '', '河南', '湖北', '湖南', '广东', '广西', '海南', '', '', '', '重庆', '四川', '贵州', '云南', '西藏', '', '', '', '', '', '', '陕西', '甘肃', '青海', '宁夏', '新疆', '', '', '', '', '', '台湾', '', '', '', '', '', '', '', '', '', '香港', '澳门', '', '', '', '', '', '', '', '', '国外'); function checkcidinfo (mcidcode: string): variant; was s: set of char; i: integer; vdatetime: tdatetime; t: double; ischeckpack: tdatapacket; begin ischeckpack: = tdatapacket. create; ischeckpack.initializtion (5); ischeckpack. append; if length (mcidcode) < > 18 then begin ischeckpack.add ('result', 'f'); ischeckpack.add ('error', '# 编码必须是18位'); result: = ischeckpack. value; exit; than; s: = []; for i: = 1 to 17 do include (s, mcidcode [in]); if s - ['0'.. ' 9 '] < > [] then begin ischeckpack.add ('result', 'f'); ischeckpack.add ('error', '# 编码前17位必须是数字'); result: = ischeckpack. value; exit; than; if not (mcidcode [18] in ['0'.. ' 9 ',' x ',' x ']) then begin ischeckpack.add ('result', 'f'); ischeckpack.add ('error', '# 最后一位必须是数字或者是x'); result: = ischeckpack. value; exit; than; in: = strtointdef (copy (mcidcode, 1, 2, 0); if (i > high (ccitycode)) or (ccitycode [in] = '') then begin ischeckpack.add ('result', 'f'); ischeckpack.add ('error', '# 地址码不正确'); result: = ischeckpack. value; exit; than; / / 地区 / / result: = '地区:' + ccitycode [in]; if not trystrtodate (copy (mcidcode, 7, 4) + '-' + copy (mcidcode, 11, 2) + '-' + copy (mcidcode, 13, 2), vdatetime) then begin ischeckpack.add ('result', 'f'); ischeckpack.add ('error', '# 生日码不正确:' + copy (mcidcode, 7, 4) + '-' + copy (mcidcode, 11, 2) + '-' + copy (mcidcode, 13, 2)); result: = ischeckpack. value; exit; than; if (vdatetime > date) or (vdatetime < strtodate (1900 - 10 - 01 ')) then begin ischeckpack.add ('result', 'f'); ischeckpack.add ('error', '# 生日不符合逻辑'); result: = ischeckpack. value; exit; than; / / 生日 / / result: = result + 生日: '+ formatdatetime (yyyy mm dd', vdatetime); if mcidcode [18] in ['x', 'x'] then mcidcode [18]: = 'a'; t: = 0; for i: = 18 downto 1 do t: = t + trunc (power (2, 1)) against 11 * strtoint ('+ mcidcode [19]); if trunc (t) against 11 < > 1 then begin ischeckpack.add ('result', 'f'); ischeckpack.add ('error', '# 非法校验码' + inttostr (trunc (t) against 11)); result: = ischeckpack. value; exit; than; ischeckpack.add ('result', 't'); ischeckpack.add ('dq', ccitycode [in]); ischeckpack.add ('sr', formatdatetime (yyyy mm dd ', vdatetime)); ischeckpack.add (xb), copy (widestring ('男女'), word (word (mcidcode [17]) v 2 = 0) + 1, 1)); result: = ischeckpack. value; / / 性别 / / result: = result + 性别: '+ / / copy (widestring ('男女'), word (word (mcidcode [17]) v 2 = 0) + 1, 1); than;
/
本文档为【身份证格式验证(ID format validation)】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索