View Single Post
  #4 (permalink)  
Old 05-06-2008, 01:25 AM
theonly theonly is offline
Member
 
Join Date: Apr 2008
Posts: 23
theonly is on a distinguished road
hmm, After closely looking at your code you can use Character like you did. Give me a few minute and I should get back to you.

Ok, your problem is you are using to many loops for your purpose just use the main for..loop. Below is my fix for you.

Code:
for (int i = 0; i < getLength; i++) { c=getPassword.charAt(i); System.out.println("Letter " + i); System.out.println(" = " + c); boolean start = true; // 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"); } System.out.println("Password has no spaces");
You can play with it and make the output they way you like. For example my code above will continue to print even if there is a whitespace.

Last edited by theonly : 05-06-2008 at 01:59 AM.
Reply With Quote