函数:utf8.codepoint 获取指定位置字符编码

函数名称:获取指定位置字符编码

函数功能:获取指定位置字符编码,以整数形式返回

函数方法

strcode = utf8.codepoint (str,i,j)

参数 类型 必填 说明
str string 输入的字符串
i number 开始位置,不写默认为 1
j number 结束位置,可不写默认为 1
返回值 类型 说明
strcode number 字符串中指定位置的字符编码

函数用例

local str = "触动精灵"
strcode = utf8.codepoint (str)
dialog(strcode)

注意事项

  • 如果处理到一个不合法的字节序列,将抛出一个错误。
Copyright 北京帮你玩科技有限公司 2023 all right reserved,powered by Gitbook该文章修订时间: 2024-03-06 17:50:18

results matching ""

    No results matching ""