join
Joins a list of values into a single string using a specified separator. Non-string values are converted to strings; None becomes an empty string.
Syntax
join(separator, source_list)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| separator | string | Yes | The separator string to insert between each element. |
| source_list | list | Yes | The list of values to join together. Non-string items are converted to strings. |
Returns
Type: string
A single string with all list elements concatenated, separated by the given separator. Returns an empty string if the list is empty.
Examples
Join a list with commas:
join(", ", [tags])
If tags is ["network", "urgent", "vpn"], the result is "network, urgent, vpn".
Join with a newline separator:
join("\n", [comments])
If comments is ["First comment", "Second comment"], the result is:
First comment
Second comment
Combine with split for delimiter replacement:
join(" | ", split([categories], ","))
If categories is "Hardware,Software,Network", the result is "Hardware | Software | Network".
Join a list of numbers:
join(";", [1, 2, 3])
The result is "1;2;3" — non-string elements are converted to strings automatically.
Notes
- If
source_listis empty orNone, the function returns an empty string"". - Non-string elements are converted to strings before joining, and
Noneelements become empty strings. For full control over formatting, convert values yourself before callingjoin. - This is the inverse of the
splitfunction.
Comments
0 comments
Please sign in to leave a comment.