Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. '-- Rules 1: Lengh is 9 include the check digit
  2. If Not vsn.Length = 9 Then
  3. Return False
  4. End If
  5.  
  6. '-- Rules 2: All digit must be numeric
  7. If Not IsNumeric(vsn) Then
  8. Return False
  9. End If
  10.  
  11. '-- Rules 3: Weight factor and divide by 11 remainder must be 0
  12. Dim sumOfWeightValue As Integer = CInt(Mid(vsn, 1, 1))*1
  13. sumOfWeightValue += CInt(Mid(vsn, 2, 1))*4
  14. sumOfWeightValue += CInt(Mid(vsn, 3, 1))*3
  15. sumOfWeightValue += CInt(Mid(vsn, 4, 1))*7
  16. sumOfWeightValue += CInt(Mid(vsn, 5, 1))*5
  17. sumOfWeightValue += CInt(Mid(vsn, 6, 1))*8
  18. sumOfWeightValue += CInt(Mid(vsn, 7, 1))*6
  19. sumOfWeightValue += CInt(Mid(vsn, 8, 1))*9
  20. sumOfWeightValue += CInt(Mid(vsn, 9, 1))*10
  21.  
  22. sumOfWeightValue = sumOfWeightValue Mod 11
  23.  
  24. If sumOfWeightValue <> 0 Then
  25. Return False
  26. Else
  27. Return True
  28. End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement