Skip to content

TableConcat

对于元素是 string 或者 number 类型的数组,返回有数组元素拼接填充字符串连接而成的字符串。

Lua数组的索引下标是从 1 开始的

业务属性

属性含义说明输入限定示例值
enable是否启用该控件,未启用时不编译是否编译选择值启用
name控件返回值命名控件输出值变量名常量resultStr
text与控件关联的文本设计页控件显示常量TableConcat
input输入参数流程变量#{array}
fillString填充字符串空则默认为空字符串常量/流程变量,
startIndex起始索引空则默认为1常量/流程变量1
endIndex截止索引空则默认为输入数组的(从索引1开始)连续整数的最大索引常量/流程变量5

使用示例

输入常量

不使用默认值

输入:#{body.array},填充字符串输入:|,起始索引输入:1,截止索引输入:3

img_4.png

输出控件返回resultStrdata属性为:

json
{
  "resultStr": "#{resultStr}"
}
{
  "resultStr": "#{resultStr}"
}
img.png

使用curl请求接口:

$ curl http://localhost:6636/api/tableConcat -d "{ \"array\": [1,2,3,4,5,6] }"
$ curl http://localhost:6636/api/tableConcat -d "{ \"array\": [1,2,3,4,5,6] }"

接口返回:

json
{
    "resultStr": "1|2|3"
}
{
    "resultStr": "1|2|3"
}

使用默认值

输入:#{body.array},其余参数设为空值

img_1.png

使用curl请求接口:

$ curl http://localhost:6636/api/tableConcat -d "{ \"array\": [1,2,3,4,5,6] }"
$ curl http://localhost:6636/api/tableConcat -d "{ \"array\": [1,2,3,4,5,6] }"

接口返回:

json
{
    "resultStr": "123456"
}
{
    "resultStr": "123456"
}

输入指定变量

填充字符串输入:#{body.fill},起始索引输入:#{body.start},截止索引输入:#{body.end}

img_3.png

使用curl请求接口:

$ curl http://localhost:6636/api/tableConcat -d "{ \"array\": [1,2,3,4,5,6], \"fill\": \"@\", \"start\": 4, \"end\": 6}"
$ curl http://localhost:6636/api/tableConcat -d "{ \"array\": [1,2,3,4,5,6], \"fill\": \"@\", \"start\": 4, \"end\": 6}"

接口返回:

json
{
    "resultStr": "4@5@6"
}
{
    "resultStr": "4@5@6"
}