JOIN(sourearray [,delimiter])

Returns the text string containing the elements in an array (String).


sourcearrayThe array of strings (String).
delimiter(Optional) The text string to use as a separator (String).

REMARKS
* After you have finished processing an array that has been split you can use this function to concatenate the elements of an array back to a string concatenation.
* The "sourcearray" must be a 1-dimensional array.
* If "delimiter" is left blank, then the a space character (" ") is used.
* If "delimiter" = "" (zero length string) then all the items are concatenated with no separator character.
* Doesn't work when the array is declared as "Date" data type (eg Dim vaArray(5) As Date).
* Does work when the array is declared as "Variant" data type (eg Dim vaArray(5) As Variant).
* This function cannot be used with fixed length arrays. You will see the following compile-time error: 'Can not assign or coerce array of fixed-length string or user defined type to Variant'.
* This function was added in Office 2000.
* The equivalent .NET function is Microsoft.VisualBasic.Strings.Join
* For the Microsoft documentation refer to docs.microsoft.com

Dim vaArray() As String 
vaArray(0) = "string1"
vaArray(1) = "string2"
vaArray(2) = "string3"

Join(vaArray) = "string1 string2 string3"
Join(vaArray," ") = "string1 string2 string3"
Join(vaArray, "<>") = "string1<>string2<>string3"
Join(vaArray, "") = "string1string2string3"

© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited Top