Join array items
Anatomy
<array:join var="var" var_result="var" delimiter="string" key="string"/>
Description: ARRAY:JOIN joins the items of an array together to form a string representation with each value separated by a given delimiter.
A given key may specify the column of a multidimensional array to join by. If however, the key is omitted, then the array is treated as an unidimensional list.
Attention:
If a key is specified and that key does not exist within the inner array, the corresponding item of the outer array will be skipped.
Attributes
| Name | Type | Description | Defined By |
|---|---|---|---|
| var | var | Variable name | array:join |
| var_result | var | Result variable name | array:join |
| delimiter | string | Delimiter | array:join |
Multidimensional
| Name | Type | Description | Defined By |
|---|---|---|---|
| key | string | Key | array:join |
Results:
| Binding | Type | Predicate |
|---|---|---|
| var_result | string | N/A |
Examples
Example
<array var="names">
<item>Bill Gates</item>
<item>Steve Jobs</item>
<item>Larry Ellison</item>
</array>
<output>
<array:join var="names" delimiter=", "/>
</output>
<!-- Bill Gates, Steve Jobs, Larry Ellison -->