Java 密码匹配算法 - isPasswordMatch() 函数实现
私有布尔类型 isPasswordMatch(String password1, String password2) { int minLength = Math.min(password1.length(), password2.length()); int halfLength = minLength / 2; int matchingChars = 0;
for (int i = 0; i < halfLength; i++) {
if (password1.charAt(i) == password2.charAt(i)) {
matchingChars++;
}
}
return matchingChars >= halfLength;
}
原文地址: https://www.cveoy.top/t/topic/o74Q 著作权归作者所有。请勿转载和采集!