--字母,数字,符号
function MatchEnglishNumSymbol(s)
for k = 1, #s do
local c = string.byte(s, k)
if c <= 20 or c >= 127 then
return false
end
end
return true
end
--数字,文字
function MatchNumWord(s)
for k = 1, #s do
local c = string.byte(s, k)
if c < 128 then
if c >= 48 and c <= 57 then--0-9
elseif c >= 65 and c <= 90 then--A-Z
elseif c >= 97 and c <= 122 then--a-z
else
return false
end
elseif c < 224 then
k = k + 1
elseif c < 240 then
k = k + 2
elseif c < 248 then
k = k + 3
elseif c < 252 then
k = k + 4
elseif c < 254 then
k = k + 5
end
end
return true
end
Lua 文本match utf8 字母,数字,符号,文字
于 2022-11-07 16:23:27 首次发布