Function Array Conversions Class

VariantMatrixToString

Assembles the elements of a two-dimensional Variant array into a String. Combine elements 1..UBound, 1..UBound of vLines into a String separated by vColumnSeparator. Separators are not included when there is only one element in the dimension.

Signature (Visual Basic / VBA)

Public Function VariantMatrixToString( _
      ByRef vLines() As Variant _
    , ByVal vColumnSeparator As Variant _
    , ByVal vRowSeparator As Variant _
    ) As String

Code Example

    Assuming
       Static avarTable(0 To 2, 0 To 2) As Variant
       ' Column--v  v--Row
       avarTable(1, 1) = "From"
       avarTable(2, 1) = "feet"
       avarTable(1, 2) = "To"
       avarTable(2, 2) = "meters"
    for example
       ? VariantMatrixToString(avarTable(), " ", vbCrLf)
       From feet
       To meters
       ? VariantMatrixToString(avarTable(), "=", "&")
       From=feet&To=meters

Parameters

Parameter Description
vLines Two-dimensional array of Variants that will be assembled into a String. Within this array, dimension #1 represents the Column and dimension #2 represents the Row. This is because the number of rows changes most frequently and the upper bound of the last dimension (representing the row) can be re-dimensioned directly by Visual Basic.
vColumnSeparator String that will separate columns within the result string. vColumnSeparator defaults to an empty String if it is missing or cannot be fixed-up to a String.
vRowSeparator String that will separate rows within the result string. vRowSeparator defaults to an empty String if it is missing or cannot be fixed-up to a String.

Notes & Version History

Note This function starts with element #1 in each dimension, instead of starting at the lower bound of the dimension.