Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools


Click here to copy the following block
' 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 feature

Function 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 < UBound(arr, 2) Then res = res & ColSeparator
    Next
    If r < UBound(arr) Then res = res & RowSeparator
  Next
  
  JoinQuoted2 = res

End Function


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.