Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. Module Module1
  2.  
  3. Sub Main()
  4. Dim FirstVal As Boolean = False
  5. Dim SecondVal As Boolean = False
  6. Dim ThirdVal As Boolean = False
  7. Dim LengthVal As Boolean = False
  8. Dim UserID As String
  9. Console.WriteLine("Enter User ID")
  10. UserID = Console.ReadLine()
  11.  
  12. If Len(UserID) = 6 Then
  13. LengthVal = True
  14. Else
  15. Console.WriteLine("Wrong format, due to length not being 6")
  16. End If
  17.  
  18. If Asc(Left(UserID, 1)) >= 65 And Asc(Left(UserID, 1)) <= 90 Then
  19. FirstVal = True
  20. Else
  21. Console.WriteLine("Wrong format, due to first letter not being uppercase")
  22. End If
  23.  
  24. If Asc(Mid(UserID, 2, 2)) >= 97 And Asc(Mid(UserID, 2, 2)) <= 122 Then
  25. SecondVal = True
  26. Else
  27. Console.WriteLine("Wrong format, due to second and third letters not being lowercase")
  28. End If
  29.  
  30. For count = 1 To 3
  31. If Asc(Right(UserID, count)) >= 48 And Asc(Right(UserID, count)) <= 57 Then
  32. ThirdVal = True
  33. Else
  34. Console.WriteLine("Wrong format, due to last 3 characters not being numbers")
  35. End If
  36. Next
  37.  
  38. If FirstVal = True And SecondVal = True And ThirdVal = True And LengthVal = True Then
  39. Console.WriteLine("Therefore, User ID is in the correct format")
  40. Else
  41. Console.WriteLine("Therefore, User ID is in the wrong format")
  42. End If
  43. Console.ReadKey()
  44. End Sub
  45.  
  46. End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement