Update StringUtils.java (#10936)

method startsWith, 当 ignoreCase 为 true 时,lowerCasePrefix 值不正确
This commit is contained in:
forachange 2023-08-14 15:22:48 +08:00 committed by GitHub
parent d756cdc6de
commit 9f28ae55a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -400,7 +400,7 @@ public class StringUtils {
} }
if (ignoreCase) { if (ignoreCase) {
String lowerCaseStr = str.toString().toLowerCase(); String lowerCaseStr = str.toString().toLowerCase();
String lowerCasePrefix = str.toString().toLowerCase(); String lowerCasePrefix = prefix.toString().toLowerCase();
return lowerCaseStr.startsWith(lowerCasePrefix); return lowerCaseStr.startsWith(lowerCasePrefix);
} else { } else {
return str.toString().startsWith(prefix.toString()); return str.toString().startsWith(prefix.toString());