Skip to content

StringLen

接收一个字符串,返回该字符串的长度。

Lua字符串的字节下标是从 1 开始的

业务属性

属性含义说明输入限定示例值
enable是否启用该控件,未启用时不编译是否编译选择值启用
name控件返回值命名控件输出值变量名常量length
text与控件关联的文本设计页控件显示常量StringLen
input输入字符串常量/流程变量#{str}

使用示例

输入常量

输入:abcdef

img_12.png

输出控件返回lengthdata属性为:

json
{
  "length": "#{length}"
}
{
  "length": "#{length}"
}
img_13.png

使用curl请求接口:

$ curl http://localhost:6636/api/stringLen
$ curl http://localhost:6636/api/stringLen

接口返回:

json
{
    "length": 6
}
{
    "length": 6
}

输入指定变量

输入:#{body.string}

img_14.png

使用curl请求接口:

$ curl http://localhost:6636/api/stringLen -d "{ \"string\": \"abcdefeg\" }"
$ curl http://localhost:6636/api/stringLen -d "{ \"string\": \"abcdefeg\" }"

接口返回:

json
{
    "length": 8
}
{
    "length": 8
}