十五位的身份证号转为十八位
public string ID15T18(string strTemp)
{
string ToString=null;
int nTemp = 0;
int[] ArrInt = new int[]{7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2};
char[] ArrCh = new char[]{'1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'};
if(strTemp.Length==15)
{
strTemp = strTemp.Substring(0,6) + '1'+ '9' + strTemp.Substring(6,strTemp.Length-6);
for(int i = 0; i < strTemp.Length; i ++)
{
nTemp+= Convert.ToInt16(strTemp.Substring(i,1)) * ArrInt[i];
}
strTemp+= ArrCh[nTemp % 11];
ToString = strTemp;
}
return ToString;
}
转自CSDN