Quantcast
Channel: VB.Classic
Viewing all articles
Browse latest Browse all 9

Combine - A Complement Function To Split

$
0
0

A piece of code I came up with whilst trying to solve a post at vbCity was what I term Combine. It basically does the opposite of Split and creates a string out of a single dimensional array.

Private Function Combine(ByVal oVvArray As Variant _
                        , ByVal strVvDelimiter As String _
                        ) As String
    Dim intLvIndex As Integer
    For intLvIndex = LBound(oVvArray) To UBound(oVvArray)
        Combine = Combine & CStr(oVvArray(intLvIndex)) & strVvDelimiter
    Next
    Combine = IIf(Right$(Combine, Len(strVvDelimiter)) = strVvDelimiter _
                 , Left$(Combine, Len(Combine) - Len(strVvDelimiter)) _
                 , Combine _
                 )
    
End Function

Viewing all articles
Browse latest Browse all 9

Trending Articles