forked from nim-lang/Nim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix isUpper, isLower for strings with non-alpha unicode chars
Fixes nim-lang#7963. This commit changes the behavior of isUpper and isLower in the unicode module -- only for the case where the input is a *string* with a mix of alphabetic and non-alphabetic unicode characters. The new behavior mimics the Python isupper and islower behavior i.e. non-alphabetic chars are ignored when checking if the whole string is upper-case or lower-case. Before: doAssert(not "A B".isUpper) passed Now: doAssert "A B".isUpper passes .. and the similar for isLower. To get the old behavior (the old behavior checked if the whole string contained only alphabetic unicode characters AND if all characters were upper/lower case), simply do: str.isAlpha and str.isUpper str.isAlpha and str.isLower (where str is a variable of type string)
- Loading branch information
1 parent
bf394ed
commit a0a105b
Showing
1 changed file
with
52 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters