public static void getRes(String arr, ArrayList<String> res) { if (arr.length() < 8) { res.add("Irregular password"); } else { boolean hasUpChar = false; boolean hasLowChar = false; boolean hasFuhao = false; boolean hasNum = false; for (int j = 0; j < arr.length(); j++) { char c = arr.charAt(j); if (Character.isDigit(c)) hasNum = true; else if (Character.isUpperCase(c)) hasUpChar = true; else if (Character.isLowerCase(c)) hasLowChar = true; else hasFuhao = true; } if (hasFuhao && hasNum && hasLowChar && hasUpChar) res.add("Ok"); else res.add("Irregular password"); } } 第二题
点赞 3

相关推荐

牛客网
牛客企业服务