--汉字算两个字符,其他算一个
local function CountSign(text)
local count = 0
for uchar in string.gmatch(text, "([%z\1-\127\194-\244][\128-\191]*)") do
if #uchar ~= 1 then
count = count +2
else
count = count +1
end
end
return count
end

博客围绕Cocos和Lua的字符相关内容展开,但具体内容缺失。Cocos常用于游戏开发,Lua是常用脚本语言,二者结合在字符处理方面可能有独特应用。
402

被折叠的 条评论
为什么被折叠?



