函数:string.byte 字符串转 ASCII 编码
函数名称:字符串转 ASCII 编码
函数功能:将字符串进行 ASCII 编码
函数方法
num1,num2,num3,.. = string.byte(str.i,j)
必填
| 参数 | 类型 | 说明 |
|---|---|---|
| str | string | 需要进行编码的字符串 |
选填
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| i | number | 1 | 编码起点,不写默认值为 1 |
| j | number | i | 编码终点,不写默认值为 i |
返回值
| 返回值 | 类型 | 说明 |
|---|---|---|
| num | number/nil | 编码后的字符串 |
函数用例
num1,num2,num3=string.byte("ceshi",1)
nLog(num1.."\r\n"..num2.."\r\n"..num3)