Note that @tamasgal’s example only detects lowercase letters. To also detect uppercase letter, you also need to check against 0x41
through 0x5a
. It’s probably also easier to understand if you write this as 'a' <= c <= 'z' || 'A' <= c <= 'Z'
, so you don’t convert toUInt8
first and have to remember all the ASCII codes, since you can just compare Char
s directly.
10 Likes