File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -768,9 +768,10 @@ def _lpython_str_upper(x: str) -> str:
768
768
def _lpython_str_isalpha (s : str ) -> bool :
769
769
char : str
770
770
for char in s :
771
- if 'a' <= char and char <= 'z' :
771
+ char_ord : i32 = ord (char )
772
+ if 65 <= char_ord and char_ord <= 90 :
772
773
continue
773
- if 'A' <= char and char <= 'Z' :
774
+ if 97 <= char_ord and char_ord <= 122 :
774
775
continue
775
776
return False
776
777
return True
@@ -781,13 +782,14 @@ def _lpython_str_title(s: str) -> str:
781
782
capitalize_next : bool = True
782
783
char : str
783
784
for char in s :
784
- if char >= 'a' and char <= 'z' :
785
+ char_ord : i32 = ord (char )
786
+ if char_ord >= 97 and char_ord <= 122 :
785
787
if capitalize_next :
786
788
result += chr (ord (char ) - ord ('a' ) + ord ('A' ))
787
789
capitalize_next = False
788
790
else :
789
791
result += char
790
- elif char >= 'A' and char <= 'Z' :
792
+ elif char_ord >= 65 and char_ord <= 90 :
791
793
if capitalize_next :
792
794
result += char
793
795
capitalize_next = False
You can’t perform that action at this time.
0 commit comments