Link Search Menu Expand Document

Concat

Description

The Concat() method joins one or more arrays onto the end of the current array.

Syntax

expression.Concat([Args1[, Args2[, …[, ArgsN]]]])

Parameters

Name
Args
Type
ParamArray Variant
Necessity
Optional
Description
The array(s) to be added to the end of the array.

Returns

Type
BetterArray / Object
Description
The current instance of the BetterArray object with the passed arrays having been added to the end.

Example

Public Sub ConcatExample()
    Dim firstItems() As Variant
    Dim secondItems() As Variant
    Dim result() As Variant
    Dim MyArray As BetterArray

    Set MyArray = New BetterArray
    firstItems = Array("Foo", "Bar")
    secondItems = Array("Fizz", "Buzz")

    MyArray.Items = firstItems
    MyArray.Concat secondItems

    result = MyArray.Items

    ' expected output:
    ' result is an array with the values: "Foo", "Bar", "Fizz", "Buzz"
End Sub

Inspiration

Back to Docs