Asking for a username with conditions
Hey,
I'm fairly new to Java and i'm having to cram a truckload worth of it into my tiny tiny brain in first semester for my course.
I want to read and store a user name chosen by the user, however, I want to implement restrictions on what characters must be included:
an example is that it must start with a letter, contain at least one digit, contain at least one symbol or punctuation mark, between 4 and 8 characters
and must not contain spaces.
I used a (Character.isLetter(userName.charAt(0))==false) line to check whether the first character is a letter and
(userName.indexOf(" ") for the spaces. However no matter how hard I try i cannot seem to figure out how to implement the other restrictions.
Any feedback on this would be much appreciated.
cheers