how can I do this...?

Results 1 to 3 of 3

Thread: how can I do this...?

  1. #1
    Join Date
    Dec 1969

    Default how can I do this...?

    ok, here is my code:<BR><BR>dim temp, i, end_number, myArr<BR>temp = request.form("temp")<BR>response.write "total:"&i&"<BR>"<BR>myArr = split(temp, ", ")<BR>for i = 0 to UBOUND(myArr)<BR> response.write "&#060;b&#062;"&myArr(i)&"&#060;/b&#062;"<BR> response.write "<BR>"<BR>next<BR><BR>what I&#039;m trying to do to get the number of times nyArr was looped, but some how need be able to get that number before the loop where this line is: response.write "total:"&i&"<BR>"<BR><BR>can this be done, and if so could some one please give me an example?<BR><BR>thanks in advance for your time!

  2. #2
    Join Date
    Dec 1969
    Los Angeles, CA

    Default LOL....sure why not

    dim lTotal<BR>myArr = split(temp, ", ")<BR>lTotal = UBOUND(myArr)<BR>response.write "total:"&lTotal&"&lt;BR&#062;"<BR>for i = 0 to lTotal<BR>response.write "&#060;b&#062;"&myArr(i)&"&#060;/b&#062;"<BR>response.write "&lt;BR&#062;"<BR>next<BR>

  3. #3
    Join Date
    Dec 1969

    Default Minor correction to Akhilesh...

    You loop goes from 0 to UBOUND(myArr), right?<BR><BR>So it loops ONE MORE TIME than the value that UBOUND(myArr) gives you.<BR><BR>&#060;%<BR>myArr = Split(temp, ", ")<BR>Response.Write "Total: " & (1 + UBOUND(myArr))<BR>For i = 0 To UBOUND(myArr)<BR> ....<BR>%&#062;<BR>or, following Ak&#039;s lead:<BR><BR>&#060;%<BR>myArr = Split(temp, ", ")<BR>loopmax = UBound(myArr)<BR>Response.Write "Total: " & (1 + loopmax)<BR>For i = 0 TO loopmax<BR> ....<BR>%&#062;<BR><BR>***************<BR><BR>Did you really think that the only place you could use UBOUND was in a FOR statement? UBOUND is a *function* and, like all other functions, can be used in *ANY* arbitrary expression.<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