Изменение регистра

Простые типы / Строки

local text = "Lower And Upper"

local lower = text:lower()
-- lower = lower and upper

local upper = text:upper()
-- upper = LOWER AND UPPER

-- No capitalize: upper the first, lower the rest
local capitalize = text:sub(1, 1):upper()
                   .. text:sub(2):lower()
-- capitalize = Lower and upper

-- Only ASCII letters change, \u{E9} stays as is
local accent = "\u{E9}"
local still_lower = accent:upper() == accent
-- still_lower = true

print("lower = " .. lower)
print("upper = " .. upper)
print("capitalize = " .. capitalize)
print("still_lower = " .. tostring(still_lower))