Skip to content

Commit 542a18d

Browse files
milanprotimfel
authored andcommitted
Fix toLowerCase not ignoring uncased characters
1 parent ccb2ce3 commit 542a18d

File tree

1 file changed

+4
-4
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/str

1 file changed

+4
-4
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/str/StringBuiltins.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,21 +1713,21 @@ abstract static class IsLowerNode extends PythonUnaryBuiltinNode {
17131713
@Specialization
17141714
@TruffleBoundary
17151715
boolean doString(String self) {
1716-
int spaces = 0;
1716+
int uncased = 0;
17171717
if (self.length() == 0) {
17181718
return false;
17191719
}
17201720
for (int i = 0; i < self.length(); i++) {
17211721
int codePoint = self.codePointAt(i);
17221722
if (!Character.isLowerCase(codePoint)) {
1723-
if (Character.isWhitespace(codePoint)) {
1724-
spaces++;
1723+
if (Character.toLowerCase(codePoint) == Character.toUpperCase(codePoint)) {
1724+
uncased++;
17251725
} else {
17261726
return false;
17271727
}
17281728
}
17291729
}
1730-
return spaces == 0 || self.length() > spaces;
1730+
return uncased == 0 || self.length() > uncased;
17311731
}
17321732
}
17331733

0 commit comments

Comments
 (0)