Arbortext Command Language > Functions by Alphabetical Listing > join (Function)
  
join (Function)
join(arr[, delim[, quote]])
This function concatenates all the elements of the array arr and returns the string result. Each element is converted to a string and those strings are concatenated, separated by the specified delimiter string delim. If delim is omitted, then a comma is used as the separator. If delim is a null string, then no separator character is used. If an array element is undefined, for example, arr is a sparse array, then a null string is used for the element value so that adjacent delimiters will appear in the string result.
If the quote parameter is specified and non-zero, then each element string value is surrounded by double quotes ("), and double quote, backslash and newline characters in the value are escaped with a backslash to form a valid ACL string term. For example, the array element value a "quote" would be represented in the result string as "a \"quote\"", if the quote was non-zero.
If arr is an associative array, then each element value is prefixed by the element's key followed by a colon. The order of the keys is unspecified.
The following example shows join reversing the effect of split:
local arr[];
split("1 2 3", arr);
local str = join(arr, " ");
# str is "1 2 3"
This example shows using join for an associative array to create a corresponding JavaScript associative array using object literal syntax:
color["red"] = 0xff0000;
color["green"] = 0x00ff00;
color["blue"] = 0x0000ff;
javascript("var color={" . join(color,',',1) . "}")
Related topic
split function