--检测中文、数字、字母
function CheckNickName(s)
local ss = {}
for k = 1, #s do
local c = string.byte(s,k)
if not c then break end
if (c>=48 and c<=57) or (c>= 65 and c<=90) or (c>=97 and c<=122) then
ss[#ss+1] = string.char(c)
elseif c>=228 and c<=233 then
local c1 = string.byte(s,k+1)
local c2 = string.byte(s,k+2)
if c1 and c2 then
local a1,a2,a3,a4 = 128,191,128,191
if c == 228 then a1 = 184
elseif c == 233 then a2,a4 = 190,c1 ~= 190 and 191 or 165
end
if c1>=a1 and c1<=a2 and c2>=a3 and c2<=a4 then
k = k + 2
ss[#ss+1] = string.char(c,c1,c2)
end
end
end
end
if #ss > 0 then
local len = 0
for k,v in pairs(ss)do
len = len + #v
end
if #s == len then
return true
else
return false
end
else
return false
end
end