Function Array Conversions Class

VariantVectorToString

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

Signature (Visual Basic / VBA)

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

Code Example

    Assuming
       Static avarCodes(0 To 3) As Variant
       avarCodes(1) = "A45"
       avarCodes(2) = "B12"
       avarCodes(3) = "C6"
    for example
       ? VariantVectorToString(avarCodes(), "--")
       A45--B12--C6
       ? VariantVectorToString(avarCodes(), "")
       A45B12C6

Parameters

Parameter Description
vLines One-dimensional array of Variants that will be assembled into a String.
vColumnSeparator String that will separate each of the elements within the result string. vColumnSeparator defaults to an empty String if it is missing or cannot be fixed-up to a String.

Notes & Version History

v1.5 BugFix Corrected a bug in the Example above.
Note This function starts with element #1 instead of starting at the lower bound.
v1.5 Note This function is very similar to the new Join function in Visual Basic 6.0.