类型 函数 库 utf8.* 返回值 数字或迭代器 修订版本 发布 2024.3703 关键词 utf8、UTF-8、Unicode、字符串、next 
根据用法检查或迭代
如果只指定了 charpos,则返回字符串中的下一个字节偏移量。
如果指定了 charpos 和 offset,将通过向当前 charpos 添加或减去charpos。
如果省略括号,则可直接将其用作迭代器
for charpos, codepoint in utf8.next, "UTF8-string" do
    print( charpos, codepoint )
end
在所有情况下,此函数都会返回一个新字符位置(以字节为单位)和该位置的代码点(数字)。
utf8.next( s [, charpos [, offset]] )
字符串。 字符串。
数字。 要开始的字符位置。
数字。 字符偏移量。
local utf8 = require( "plugin.utf8" ) local testStr = "♡ 你好,世界 ♡" print( utf8.next( testStr, 2 ) ) --> 3 161
local utf8 = require( "plugin.utf8" )
local testStr = "♡ 你好,世界 ♡"
for charpos, codepoint in utf8.next, testStr do
    print( charpos, codepoint )
end
--> 1   9825
--> 4   32
--> 5   20320
--> 8   22909
--> 11  65292
--> 14  19990
--> 17  30028
--> 20  32
--> 21  9825