因工作需要,结合网上的算法,写了个身份证号码升位函数
'功能:将15的身份证号升为18位(根据GB 11643-1999)
'参数:原来的号码
'返回:升位后的18位号码
Private Function GetSfzh(ByVal strSfzh As String) As String
Dim strJiaoYan() As Char = {"1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"}
Dim intQuan() As Integer = {7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2, 1}
Dim strTemp As String
Dim intTemp As String
Dim i As Integer
strTemp = strSfzh.Substring(0, 6) & "19" & strSfzh.Substring(6)
For i = 0 To strTemp.Length - 1
intTemp += Int32.Parse(strTemp.Substring(i, 1)) * intQuan(i)
Next
intTemp = intTemp Mod 11
Return strTemp & strJiaoYan(intTemp)
End Function