函数的介绍和用法
介绍:串口屏脚本中的函数为内置函数,类似系统提供的工具,完成一些脚本不能实现的功能。
使用:使用方式同C语言。
函数列表
- 使用函数编辑器
- 1. Flash操作
- 2. SD卡操作
- 3. 发送数据
- 4. 字符串处理
- 前退格函数 – stringTrimStart
- 后退格函数 – stringTrimEnd
- 在字符串中查找某一字符串的出现位置 – stringIndex
- 返回某一字符串的字符个数 – stringLength
- 返回某一字符串的子字符串 – stringSub
- 在字符串的指定位置插入字符串 – stringInsert
- 移除字符串中的部分字符 – stringRemove
- 替换字符串中的字符 – stringReplace
- 提取包含单个字符的字符串 – stringGet
- 修改字符串的单个字符 – stringSet
- 将字符转换为小写形式 – stringLower
- 将字符转换为大写形式 – stringUpper
- 5. 数学函数
- 返回弧度角 x 的正弦:float sin(float x)
- 返回弧度角 x 的余弦:float cos(float x)
- 返回弧度角 x 的正切:float tan(float x)
- 返回以弧度表示的 x 的反正弦:float asin(float x)
- 返回以弧度表示的 x 的反余弦:float acos(float x)
- 返回以弧度表示的 x 的反正切:float atan(float x)
- 四舍五入:float round(float x)
- 返回大于或等于 x 的最小的整数值:int ceil(float x)
- 返回整数 x 的绝对值:int abs(int x)
- 返回浮点数 x 的绝对值:float fabs(float x)
- 求平方根:float sqrt(float x)
- 返回小于或等于x的最大整数:float floor(float x)
- 返回x的y次幂:float pow(float x, float y)
- 返回x以底数为10时的对数:float log10(float x)
- 6. 类型转换
- 字节转十六进制字符串 – byteToHex
- 将十六进制字符串转换为字节 – hexToByte
- 整型转十六进制字符串 – intToHex
- 将十六进制字符串转换为整数 – hexToInt
- 整型转字符串型 – intToString
- 字符串型转整型 – stringToInt
- 整型转字节数组 – intToBytes
- 提取整数 – bytesToInt
- 浮点型转字符串型 – floatToString
- 字符串型转浮点型 – stringToFloat
- 浮点型转字节数组 – floatToBytes
- 提取浮点数 – bytesToFloat
- 提取Ascii字符串 – bytesToAscii
- 提取标准字符串 – bytesToString
- ascii字符串转字节数组 – asciiToBytes
- 字符串转字节数组 – stringToBytes
- 从字节数组中解码字符串 – stringDecode
- 将字符串编码为字节数组 – stringEncode
- 提取短整数 – bytesToShort
- 提取无符号短整数 – bytesToUshort
- 将十六进制字符串转换为字节数组 – hexToBytes
- (已删除)浮点型转整型 – floatToInt
- 7. 控件属性读写
- 8. CRC 计算
- 9. 其他函数
- 使用函数编辑器
- 连接测试