-- 下面的代碼能夠實如今字符之間插入指定字符(lua),給你們分享下,可能笨拙一些,不過解決了問題 function ui.string_insert(str,insertStr) local len = #str; local left = len; local cnt = 0; local arr={0,0xc0,0xe0,0xf0,0xf8,0xfc}; local indx = -left; local newstr = ""; while left ~= 0 do local tmp=string.byte(str,-left); local i=#arr; while arr do if tmp>=arr then left=left-i; break; end i=i-1; end local substr = string.sub(str,indx,-left - 1); if left ~= 0 then newstr = newstr .. substr .. insertStr; else newstr = newstr .. substr; end indx = -left; cnt=cnt+1; end return newstr; end