goody9807  
避风的港湾-云之宇~~~寻找.Net的精华

超级大富翁、葵花点穴手、反恐精英、超级玛丽、挖金子、 赛车总动员
公告
日历
<2006年11月>
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789
统计
  • 随笔 - 482
  • 文章 - 4
  • 评论 - 593
  • 引用 - 114

导航

与我联系

搜索

 

常用链接

我参与的团队

我的标签

随笔分类(476)

我的空间

友情链接

积分与排名

  • 积分 - 377889
  • 排名 - 89

最新评论

60天内阅读排行

 
 1using System;
 2using System.Collections;
 3
 4public class MyClass
 5{
 6    public static void Main()
 7    {
 8        Console.WriteLine(per15To18("429005811009091"));
 9        RL();
10    }

11    
12    public static string per15To18(string perIDSrc) 
13  
14   int iS = 0
15 
16   //加权因子常数 
17   int[] iW=new int[]{7910584216379105842};
18   //校验码常数 
19   string LastCode="10X98765432"
20   //新身份证号 
21   string perIDNew; 
22 
23   perIDNew=perIDSrc.Substring(0,6);
24   //填在第6位及第7位上填上‘1’,‘9’两个数字 
25   perIDNew += "19"
26 
27   perIDNew += perIDSrc.Substring(6,9); 
28 
29   //进行加权求和 
30   forint i=0; i<17; i++
31   
32    iS += int.Parse(perIDNew.Substring(i,1)) * iW[i]; 
33   }
 
34     
35   //取模运算,得到模值 
36   int iY = iS%11;
37   //从LastCode中取得以模为索引号的值,加到身份证的最后一位,即为新身份证号。 
38   perIDNew += LastCode.Substring(iY,1); 
39
40   return perIDNew;
41  }
 
42
43
44
45    
46    Helper methods
64}
posted on 2006-11-13 16:32 PointNet 阅读(1176) 评论(5)  编辑 收藏 网摘 所属分类: .Net基础知识
评论:



发表评论

昵称: [登录] [注册]

主页:

邮箱:(仅博主可见)

评论内容:

  登录  注册

[使用Ctrl+Enter键快速提交评论]

0 559378




相关文章:

相关链接:
 
Copyright © PointNet Powered by: 博客园 模板提供:沪江博客