Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '-- Rules 1: Lengh is 9 include the check digit
- If Not vsn.Length = 9 Then
- Return False
- End If
- '-- Rules 2: All digit must be numeric
- If Not IsNumeric(vsn) Then
- Return False
- End If
- '-- Rules 3: Weight factor and divide by 11 remainder must be 0
- Dim sumOfWeightValue As Integer = CInt(Mid(vsn, 1, 1))*1
- sumOfWeightValue += CInt(Mid(vsn, 2, 1))*4
- sumOfWeightValue += CInt(Mid(vsn, 3, 1))*3
- sumOfWeightValue += CInt(Mid(vsn, 4, 1))*7
- sumOfWeightValue += CInt(Mid(vsn, 5, 1))*5
- sumOfWeightValue += CInt(Mid(vsn, 6, 1))*8
- sumOfWeightValue += CInt(Mid(vsn, 7, 1))*6
- sumOfWeightValue += CInt(Mid(vsn, 8, 1))*9
- sumOfWeightValue += CInt(Mid(vsn, 9, 1))*10
- sumOfWeightValue = sumOfWeightValue Mod 11
- If sumOfWeightValue <> 0 Then
- Return False
- Else
- Return True
- End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement