diff options
author | Kaushal Modi <kaushal.modi@gmail.com> | 2018-06-06 17:44:11 -0400 |
---|---|---|
committer | Kaushal Modi <kaushal.modi@gmail.com> | 2018-06-08 15:14:29 -0400 |
commit | 24df909d8a953f2b7ba0e0d1adf3a256042cd9bc (patch) | |
tree | 8ee5c50bf6084fa1c60a3c29f8601946230666d2 /compiler/semmagic.nim | |
parent | 3e799d7876110d970c365d61c05e887729488e2f (diff) | |
download | Nim-24df909d8a953f2b7ba0e0d1adf3a256042cd9bc.tar.gz |
Make isUpper (and variants) work for strings with non-alpha chars
The other variants are isLower, isUpperAscii and isLowerAscii Fixes https://github.com/nim-lang/Nim/issues/7963. This commit changes the behavior and signatures of: - isUpper, isLower in the unicode module - isUpperAscii, isLowerAscii in the strutils module A second mandatory parameter skipNonAlpha is added to these 4 procs. (This change affects only for the case where the input is a *string*.) --- With skipNonAlpha set to true, the behavior mimics the Python isupper and islower behavior i.e. non-alphabetic chars/runes are ignored when checking if the string is upper-case or lower-case. Before this commit: doAssert(not isUpper("A B")) After this commit: doAssert(not isUpper("A B", false)) <-- old behavior doAssert isUpper("A B", true) Below two are equivalent: isUpper("A B", true) isAlpha("A B") and isUpper("A B", false) .. and the similar for other 3 procs.
Diffstat (limited to 'compiler/semmagic.nim')
0 files changed, 0 insertions, 0 deletions