devxlogo

JoinQuote2 – A Join variant that works with 2-dimensional arrays and quoted strings

JoinQuote2 – A Join variant that works with 2-dimensional arrays and quoted strings

' Join variant that works with' bi-dimensional arrays of any type' and that encloses string values between quotes'' ARR is the 2-dimensional array whose element must be joined' ROWSEPARATOR is the separator for rows (default is CRLF)' COLSEPARATOR is the separator fol columns (default is comma)' QUOTED is the character used to quote string values'     use a two-char string (eg "{}") if the openining'     and closing quote chars are different'     use a null string to suppress quoting featureFunction JoinQuoted2(arr As Variant, Optional ByVal RowSeparator As String = _    vbCrLf, Optional ByVal ColSeparator As String = ",", _    Optional ByVal Quotes As String = """") As String    Dim res As String    Dim r As Long    Dim c As Long        For r = LBound(arr) To UBound(arr)        For c = LBound(arr, 2) To UBound(arr, 2)            If VarType(arr(r, c))  vbString Then                res = res & arr(r, c)            Else                ' the following code works correctly if                ' LEN(Quotes) is 0,1,2                res = res & Left$(Quotes, 1) & arr(r, c) & Right$(Quotes, 1)            End If            If c 

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist