View Single Post
  #6 (permalink)  
Old 05-06-2008, 03:12 AM
dablyz dablyz is offline
Member
 
Join Date: May 2008
Posts: 7
dablyz is on a distinguished road
// Checks for space
boolean b_space = Character.isWhitespace(c);
if (b_space == true)
System.out.println("You have a space in your password, please remove it and try again");

boolean b_ucase = Character.isUpperCase(c);
if (b_ucase == false)
System.out.println("You have no uppercase letters");

boolean b_lcase = Character.isLowerCase(c);
if (b_lcase == false)
System.out.println("You have no lower letters");

boolean b_digit = Character.isDigit(c);
if (b_digit == false)
System.out.println("You have no digits");



}


I have tried using this, but it doesnt really work for the digit part. I think my program is essentialy doing what it is supposed to: checking each char for the type - but my problem is that it is reporting on every one.

e.g

Please enter your username...
sam
Welcome sam!
Please enter your password for validation...
TTYG676
Password length = 7
= T
You have no lower letters
You have no digits
= T
You have no lower letters
You have no digits
= Y
You have no lower letters
You have no digits
= G
You have no lower letters
You have no digits
= 6
You have no uppercase letters
You have no lower letters
= 7
You have no uppercase letters
You have no lower letters
= 6
You have no uppercase letters
You have no lower letters


(the = signs are purely there for making sure that the letters are at least picked up)
Reply With Quote