Files
2026-03-15 14:54:49 +03:00

24 lines
891 B
Lua
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
if utf8 == nil then
utf8 = {
charpattern = '[%z\x01-\x7F\xC2-\xF4][\x80-\xBF]*'
}
end
local uc_lc = {['А']='а',['Б']='б',['В']='в',['Г']='г',['Д']='д',['Е']='е',['Ё']='ё',['Ж']='ж',['З']='з',['И']='и',['Й']='й',['К']='к',['Л']='л',['М']='м',['Н']='н',['О']='о',['П']='п',['Р']='р',['С']='с',['Т']='т',['У']='у',['Ф']='ф',['Х']='х',['Ц']='ц',['Ч']='ч',['Ш']='ш',['Щ']='щ',['Ъ']='ъ',['Ы']='ы',['Ь']='ь',['Э']='э',['Ю']='ю',['Я']='я'}
local lc_uc = {}
for uc, lc in pairs(uc_lc) do
lc_uc[lc] = uc
end
setmetatable(uc_lc, {__index = function(_, char) return char:lower() end})
setmetatable(lc_uc, {__index = function(_, char) return char:upper() end})
function utf8.lower(text)
return text:gsub(utf8.charpattern, uc_lc)
end
function utf8.upper(text)
return text:gsub(utf8.charpattern, lc_uc)
end