join

Joins all elements of an array into a string.

Applies to

Array

Syntax

join(separator)

Parameters

separator

Specifies a string to separate each element of the array. The separator is converted to a string if necessary. If omitted, the array elements are separated with a comma.

Description

The string conversion of all array elements are joined into one string.

Examples

The following example creates an array with three elements, then joins the array three times: using the default separator, then a comma and a space, and then a plus.

a = new Array("Wind","Rain","Fire")
Console.Write(a.join())
Console.Write(a.join(", "))
Console.Write(a.join(" + "))

This code produces the following output:

Wind,Rain,Fire
Wind, Rain, Fire
Wind + Rain + Fire

See also

Array: reverse