Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I' not sure how to do this. The code is supposed to validate the user id that is entered so that there is 1 upper case letter, 2 lower case letters and 3 digits,eg Hap123.

What I have tried:

Dim UserId As String
Dim Length As Integer
Dim Format As String
Console.WriteLine("Input your User ID")
UserID=Console.ReadLine

WHILE Length = 6
IF Format = UCASE(Left(UserID,1))& LCASE(MID(UserID,2,2))&INT(RIGHT(UserID,3))
THEN Console.WriteLine("Correct format")
ELSE Console.WriteLine("Wrong format")
ENDIF
ENDWHILE
Posted
Updated 10-Mar-16 0:43am

1 solution

I would use regular expressions to validate input string formatting.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900