function GetCharNewStrByLimit(str,limitCharNum)
local bytes = {str:byte(1,#str)}
local length,begin,cutByteLength = 0,false,0
for _, byte in ipairs(bytes) do
if byte < 128 or byte >= 192 then
begin = false
length = length + 1
elseif not begin then
begin = true
length = length + 1
if length > limitCharNum then
cutByteLength = cutByteLength - 1
end
else
if length > limitCharNum then
cutByteLength = cutByteLength + 1
end
end
if length <= limitCharNum then
cutByteLength = cutByteLength + 1
else
break
end
end
return string.sub(str,1,cutByteLength)
end