Tec*_*dle 2 string lowercase julia
如何检查字符串中的每个字符是小写还是空格?
"this is all lowercase" -> true
"THIS is Some uppercase " -> false
"HelloWorld " -> false
"hello world" -> true
Run Code Online (Sandbox Code Playgroud)
你可以使用谓词/ itr方法all(docs:
julia> f(s) = all(c->islower(c) | isspace(c), s);
julia> f("lower and space")
true
julia> f("mixED")
false
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
355 次 |
| 最近记录: |