|
-
Feb 24th, 2008, 06:09 AM
#1
2 dimensional join function
this is to simply join a 2 dimensional array with 2 delimiters
accepts any type of array, returns a string
vb Code:
Function join2(myarr, chr1 As String, chr2 As String) As String Dim mystr As String, i As Integer, j As Integer mystr = "" For i = LBound(myarr, 1) To UBound(myarr, 1) For j = LBound(myarr, 2) To UBound(myarr, 2) - 1 mystr = mystr & CStr(myarr(i, j)) & chr1 Next mystr = mystr & CStr(myarr(i, j)) & chr2 Next join2 = mystr End Function
call like
vb Code:
Debug.Print join2(myarr, vbTab, vbNewLine)
Last edited by westconn1; Aug 18th, 2010 at 04:52 AM.
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Mar 21st, 2012, 10:12 AM
#2
New Member
Re: 2 dimensional join function
Last edited by sat19; Mar 21st, 2012 at 10:16 AM.
Reason: Posted on wrong thread
-
Mar 21st, 2012, 10:14 AM
#3
New Member
Re: 2 dimensional join function
My apologies, posted my code on wrong thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|