Let's say I have a string x="1. this should be capitalized"
Right now if I want to check if the first letter is capitalized
s = "1. (t)his should be capitalized"
s2 = match(r"^.*?([a-zA-Z])", s).captures[1]
@show all(islowercase, s2)
# true
If I do islowercase(s2)
I get a MethodError
. Though I could also do @show uppercasefirst(s2) != s2
but this seems unnecessarily verbose.
As you have noted, islowercase
works with individual characters, and not strings. To extract the first character from the regex match string you can use first
:
julia> s = "1. (t)his should be capitalized";
julia> s2 = match(r"^.*?([a-zA-Z])", s).captures[1]
"t"
julia> islowercase(first(s2))
true