- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Define islowercase for String #46444
Comments
FYI:
|
I also think lowercase has to do with a character and not a string. Using |
IMO, it's very odd that |
On the other hand, the definition that people seem to want in many cases is: all(c -> lowercase(c) == c, s) # equivalent to lowercase(s) == s which is not the same thing as This ambiguity may be a good argument for not defining |
Consider julia> "élan" == lowercase("élan")
true
julia> all(c -> c == lowercase(c), "élan")
true
julia> all(islowercase, "élan")
false If you are confused by this, realize that julia> all(islowercase, "élan")
true (But if you define |
julia> all(islowercase, "élan")
false Is probably a wrong result for most people. which is something to worry about |
@gbaraldi, is this the "wrong" result: julia> all(islowercase, "1")
false
julia> islowercase('1')
false
julia> all(islowercase, "́") # "\acute"
false
julia> islowercase('́') # '\acute'
false ? |
We explicitly decided to remove these kinds of predicates for strings in v0.6. |
Does it make sense to rather define as (and vise versa):
|
In particular, this was done in #20342, following the discussion in #14156.
No, because then In general, the fact that there are so many variations on what it might mean for a string to "be lowercase" (e.g. |
Note that Julia isn't alone here. See e.g. Swift’s string.lowercased() method and char.isLowercased property. Or the C# String.ToLower() and Char.IsLower methods. Or the Go ToLower(str) and IsLower(char) functions. Or … The odd one out is Python, which does have a |
I think this can be closed. I don't see an overwhelmingly convincing reason to revisit this decision. |
In 1.7
islowercase
is defined for characters but not strings. It would be useful to have for strings.(From discourse.)
The text was updated successfully, but these errors were encountered: