Generic selectors
Exact matches only
Search in title
Search in content

Reply To: Problem in IMEI with nokia switch

#40033
Misa
Guest

Here is the VB function:

Function CheckDigit(sImei As String) As String
Dim iDigit(0 To 14) As Integer, i As Integer, iCD As Integer, sCD As String
For i = 1 To 14
iDigit(i) = CInt(Mid(sImei, 15 – i, 1))
If i Mod 2 = 1 Then
iDigit(i) = 2 * iDigit(i)
If iDigit(i) > 9 Then iDigit(i) = iDigit(i) – 9
End If
Next
For i = 1 To 14
iCD = iCD + iDigit(i)
Next
If iCD Mod 10 = 0 Then
sCD = “0”
Else
sCD = CStr(((iCD \ 10) + 1) * 10 – iCD)
End If
CheckDigit = sCD
End Function