Difference of Array Concept between ASP and JAVA

Results 1 to 3 of 3

Thread: Difference of Array Concept between ASP and JAVA

  1. #1
    Hiroko Guest

    Default Difference of Array Concept between ASP and JAVA

    Hello All,<BR>In Java or C++,a row of 2D array can be regards<BR>as a 1D array.Say <BR>we define array1[10][9],<BR>then array[0] is a 1D array of size 9.<BR><BR>However,In ASP,it seems this concept cannot apply:<BR>&#060;%<BR>redim var(2,3)<BR>var(0,2)="John"<BR><BR>array(var(0)) &#039 i want to put the var[0] ,the 1D array <BR><BR>sub array(col)<BR>&#039i want to get 3rd element of 1D array,var[0],that is var[0][2]<BR>response.write (col(2)) <BR>end sub <BR>%&#062;<BR><BR>Which I expected it will return "John",but it has error instead.<BR>Can any ASPers Help?<BR>

  2. #2
    Steve Cimino Guest

    Default RE: Difference of Array Concept between ASP and JA

    You&#039re right, the concept doesn&#039t apply. You have to reference a multidimension array the same all the time (ie, you always have to use 0,0 1,0, 1,1 etc), instead of referring to the one element.<BR><BR>Watch your redim statement also, for if you try to preserve, you&#039re limited to the last dimension only. From the help file:<BR><BR>Remarks<BR>The ReDim statement is used to size or resize a dynamic array that has already been formally declared using a Private, Public, or Dim statement with empty parentheses (without dimension subscripts). You can use the ReDim statement repeatedly to change the number of elements and dimensions in an array.<BR>If you use the Preserve keyword, you can resize only the last array dimension, and you can&#039t change the number of dimensions at all. For example, if your array has only one dimension, you can resize that dimension because it is the last and only dimension. However, if your array has two or more dimensions, you can change the size of only the last dimension and still preserve the contents of the array. <BR><BR>The following example shows how you can increase the size of the last dimension of a dynamic array without erasing any existing data contained in the array. <BR><BR>ReDim X(10, 10, 10)<BR>. . .<BR>ReDim Preserve X(10, 10, 15)<BR>

  3. #3
    Join Date
    Dec 1969

    Default Multiple posting...see answer in other forum...

    Grumble. I *HATE* multiple posters!<BR><BR>Anyway, Steve, did you consider an array of arrays in VBS?<BR><BR>See my posting in (I think) other forum. If not, it&#039s elsewhere in this one.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts