1. Linda Guest

Hola People<BR>As you can tell I am new to all of this. You can tell by my recent postings.<BR>But I&#039;m glad of the support from this forum.<BR>OK. Here is my problem.<BR><BR>I want to construct a loop program. In this program I want to specify a range of<BR>values. <BR>1) Range of values - 0 to 10,000<BR>2) I want each range to output a corresponding value in the form of:<BR><BR> 0 = AAAA<BR> 1 = AAAB<BR> 2 = AAAC<BR> ....<BR> 25 = AAAZ<BR> ....<BR> 26 = AABA<BR> 27 = AABB<BR> 28 = AABC<BR><BR>and so on...<BR><BR>So I want each letter to increase through the alphabet and when it comes to Z to increase<BR>the proceeding letter to the next letter -- and so on.<BR><BR>Please HELP !! <BR><BR>The ASP / SQL Rookie<BR><BR>* Linda ;) *

2. New ASP Guest

## You own me 30 mins labor salary! Linda!!

&#060;%@ Language=VBScript %&#062;<BR>&#060;%OPTION EXPLICIT%&#062;<BR>&#060;%<BR><BR>DIM myletter(26)<BR>DIM mytest()<BR>DIM i_0<BR>DIM i_1<BR>DIM i_2<BR>DIM i_3<BR>DIM i, j<BR><BR><BR>FOR i = 0 TO 25<BR> myletter(i) = chr(65+i)<BR>NEXT<BR><BR>i_0 = 0<BR>i_1 = 0<BR>i_2 = 0<BR>i_3 = 0<BR><BR><BR>FOR i = 0 TO 1000<BR><BR>REDIM PRESERVE mytest(i)<BR><BR>mytest(i) = myletter(i_3) & myletter(i_2) & myletter(i_1) & myletter(i_0)<BR> <BR> i_0 = i_0 + 1<BR> <BR> IF i_0 = 26 THEN<BR> i_0 = 0<BR> i_1 = i_1 + 1<BR> END IF<BR><BR> IF i_1 = 26 THEN<BR> i_1 = 0<BR> i_2 = i_2 + 1<BR> END IF<BR><BR> IF i_2 = 26 THEN<BR> i_2 = 0<BR> i_3 = i_3 + 1<BR> END IF<BR> Response.Write mytest(i) & "<BR>"<BR><BR>NEXT%&#062;

3. oli
Senior Member
Join Date
Dec 1969
Posts
3,961

Warning this will tie up your server for a while...<BR>&#060;%<BR>For i=65 To 90<BR>&nbsp;&nbsp;For j=65 To 90<BR>&nbsp;&nbsp;&nbsp;&nbsp;For k=65 To 90<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;For l=65 To 90<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;Response.write Chr(i) & Chr(j) & Chr(k) & Chr(l) & "&#060; br&#062;"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;N ext<BR>&nbsp;&nbsp;&nbsp;&nbsp;Next<BR>&nbsp;&nbsp ;Next<BR>Next<BR>%&#062;

4. oli
Senior Member
Join Date
Dec 1969
Posts
3,961

## Plus 3 minutes of mine ;)

.

5. Steve Cimino Guest

## RE: One note

FOR i = 0 TO 1000<BR><BR>REDIM PRESERVE mytest(i)<BR><BR>Why are you redimming an array that you already know the size of within your loop? A waste of resources... you already know it&#039;s going to be 1000, so move that outside of your loop.<BR><BR>Redim preserve mytest(1000)<BR>For i = 0 to 1000

6. New ASP Guest

## But

If Linda pass a parameter from somewhere, say:<BR><BR>FOR i = 0 TO var &#060;-- You will never know ...:)<BR>The loop number is NOT known, That is why I don&#039;t use <BR>3 inner loops like next solution.

#### Posting Permissions

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