satoru
How to check if a Unicode codepoint represents a letter or an uppercase letter?
I’m working on the “Bob” exercise on the Elixir Track in Exercism.
I am testing for uppercase letter with this simple check: c in ?A..?Z, but one of the test cases requires that Unicode uppercase letters be handled.
I’ve Googled a little bit and couldn’t found anything useful. An answer on Stackoverflow suggested to use regular expression on the string. I wonder if there’s anything as simple as Unicode.is_upper? in the standard library.
Most Liked
malaire
Perhaps check if Unicode.category/1 returns :Lu.
EDIT: Just noticed that there is also Unicode.uppercase?/1 which does this exact check.
LostKobrakai
I was about to suggest ex_unicode as well, but given the nature of this being an exercise I doubt they expect people to use an external dependency.
egze
Just a hint, I don’t think you need to check every codepoint individually, but instead try to work with the whole string input and just the String module.
Popular in Chat/Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









