function ID15T18(strTemp)
{
var arrInt = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
var arrCh = new Array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
var nTemp = 0, i;
if(strTemp.length==15)
{
strTemp = strTemp.substr(0,6) + '19' + strTemp.substr(6,strTemp.length-6);
for(i = 0; i < strTemp.length; i ++)
{
nTemp += strTemp.substr(i, 1) * arrInt[i];
}
strTemp += arrCh[nTemp % 11];
}
return strTemp;
}
VB 版
private string Convert15To18(string strTemp)
{
int[] arrInt = new int[]{7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2};
string arrCh="10X98765432";
int nTemp = 0;
if(strTemp.Length==15)
{
strTemp = strTemp.Substring(0,6) + "19" + strTemp.Substring(6,strTemp.Length-6);
for(int i = 0; i < strTemp.Length; i++)
{
nTemp += int.Parse(strTemp.Substring(i, 1).ToString()) * arrInt[i];
}
strTemp += arrCh[nTemp % 11];
}
char dd=arrCh[nTemp % 11];
return strTemp;
}