Browse Source

Pwcheckerclass

master
drddro 1 year ago
parent
commit
169543139f
1 changed files with 28 additions and 0 deletions
  1. 28
    0
      src/PasswordChecker.java

+ 28
- 0
src/PasswordChecker.java View File

public class PasswordChecker { public class PasswordChecker {

private final static int pwMinLength = 6;

public static boolean pwLength(String password){
return password.length() >= pwMinLength;
}

public static boolean pwContainsNum(String password){
for (int i = 0; i < password.length(); i++) {
if(Character.isDigit(password.charAt(i))){
return true;
}
}
return false;
}

private static boolean pwContainsSpecialHelper(char c){
return(!(Character.isDigit(c)|| Character.isLetter(c)));
}

public static boolean pwContainsSpecial(String password){
for (int i = 0; i < password.length(); i++) {
if(pwContainsSpecialHelper(password.charAt(i))){
return true;
}
}
return false;
}
} }

Loading…
Cancel
Save