String Join
The string::join
function concatenates elements of a list into a single string, with each element separated by the given delimiter.
Syntax
string::join(<delimiter>, <list>)
Parameters
delimiter
: The string used to separate each element in the resulting string.list
: The list of strings to be joined.
Returns
- String: A single string formed by joining the elements of the list with the delimiter.
Example
string::join(", ", ["apple", "banana", "cherry"])
This function is useful for converting lists of strings into a single string representation with a specified separator.