-- %u is an upper case letter, %l is lower case
local char = "a"
local is_upper = char:match("%u") ~= nil
local is_lower = char:match("%l") ~= nil
-- is_upper = false
-- is_lower = true
-- Only ASCII letters have a case here
local cyrillic = "\u{416}"
local is_upper_cyrillic =
cyrillic:match("%u") ~= nil
-- is_upper_cyrillic = false
-- No case: both are false
local digit = "1"
local is_upper_digit = digit:match("%u") ~= nil
local is_lower_digit = digit:match("%l") ~= nil
-- is_upper_digit = false
-- is_lower_digit = false
-- Comparing with upper() is true for a digit too
local same_as_upper = digit == digit:upper()
-- same_as_upper = true
print("is_upper = " .. tostring(is_upper))
print("is_lower = " .. tostring(is_lower))
print("is_upper_cyrillic = "
.. tostring(is_upper_cyrillic))
print("is_upper_digit = "
.. tostring(is_upper_digit))
print("is_lower_digit = "
.. tostring(is_lower_digit))
print("same_as_upper = "
.. tostring(same_as_upper))