Appearance
TableConcat
对于元素是 string 或者 number 类型的数组,返回有数组元素拼接填充字符串连接而成的字符串。
Lua数组的索引下标是从 1 开始的
业务属性
属性 | 含义 | 说明 | 输入限定 | 示例值 |
---|---|---|---|---|
enable | 是否启用该控件,未启用时不编译 | 是否编译 | 选择值 | 启用 |
name | 控件返回值命名 | 控件输出值变量名 | 常量 | resultStr |
text | 与控件关联的文本 | 设计页控件显示 | 常量 | TableConcat |
input | 输入参数 | 流程变量 | #{array} | |
fillString | 填充字符串 | 空则默认为空字符串 | 常量 /流程变量 | , |
startIndex | 起始索引 | 空则默认为1 | 常量 /流程变量 | 1 |
endIndex | 截止索引 | 空则默认为输入数组的(从索引1开始)连续整数的最大索引 | 常量 /流程变量 | 5 |
使用示例
输入常量
不使用默认值
输入:#{body.array}
,填充字符串输入:|
,起始索引输入:1
,截止索引输入:3

输出控件返回resultStr
,data属性为:
json
{
"resultStr": "#{resultStr}"
}
{
"resultStr": "#{resultStr}"
}

使用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}
,其余参数设为空值

使用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}

使用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"
}