函数:string.len 获取字符串字节数

函数名称:获取字符串字节数

函数功能:获取字符串字节数

函数方法

num = string.len(str)

参数 类型 必填 说明
str string 需要计算的字符串
返回值 类型 说明
num number/nil 字符串字节数

函数用例

str="JUST DO IT"
num = string.len(str)
dialog("字符串字节数:"..num)

注意事项

  • 每个中文 3 个字节。
Copyright 北京帮你玩科技有限公司 2024 all right reserved,powered by Gitbook该文章修订时间: 2025-11-07 12:46:09

results matching ""

    No results matching ""