Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Best method to Display a two dimensional Array. 1

Status
Not open for further replies.

Deadline

Programmer
Feb 28, 2001
367
US
Best method to Display a two dimensional Array.

Hello,

Do you know or have a piece of code(Function) that is best for displaying two dimensional array ? Something to the equivalent of Split and Join for uni-dimensional arrays.

Please help. A little desperate.



Thank you,
RR.
__________________________________
The best is yet to come.
 
Not sure what environment you're displaying this in, but we'll call it what the forum suggests and do an html table...

===========================================================
response.write(&quot;<table>&quot;)
for y = 1 to Ubound(myarray,1) 'get size of total first elements

response.write(&quot;<tr>&quot;)

for x = 1 to Ubound(myarray,2) 'get size of total second elements

response.write(&quot;<td>&quot;+myarray(y,x)+&quot;</td>&quot;)

next x

response.write(&quot;</tr>&quot;)

next y
response.write(&quot;</table>&quot;)
===========================================================

That should display your data in a tablized format... was that what you were shooting for?

AT
 
Yes it is AT. Thank you very much.

Just curious, is there a function like join and split ?
Thank you,
RR.
__________________________________
The best is yet to come.
 
There are indeed those functions. I use Split frequently, but so far have not had any use for the Join function. Below are some examples of these functions:
==========================================================

'Split function
mystring = &quot;A,B,C,D,E,F,G&quot;
Dim arrayelementz

arrayelementz = Split(mystring,&quot;,&quot;) 'String to split, using the comma as the delimiter
'This would return a one dimensional array starting at arrayelementz(0), containing all letters A - G respectively



'Join function
Dim myarray(10)

myarray(1) = &quot;a&quot;
myarray(2) = &quot;b&quot;
myarray(3) = &quot;c&quot;
myarray(4) = &quot;d&quot;
myarray(5) = &quot;e&quot;
myarray(6) = &quot;f&quot;
myarray(7) = &quot;g&quot;
myarray(8) = &quot;h&quot;
myarray(9) = &quot;i&quot;

x = Join(myarray)

'x would equal &quot;a b c d e f g h i&quot;


==========================================================
Both these functions deal with ONE dimensional arrays only. If you tried to show it a 4 dimensional array, it would just laugh at you [pipe]
 
Thanks again AT. But I was wondering if there is something similar to Join and Split for multidimensional arrays.

Now I know.


Thank you,
RR.
__________________________________
The best is yet to come.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top