alphabetic for...next loops?

1. Dan
Senior Member
Join Date
Dec 1969
Posts
1,364

## alphabetic for...next loops?

Instead of doing For I=1 to 26, i want to do<BR><BR>For I="a" to "z"<BR><BR>what is the right way to do this?

2. Medieval Dude Guest

## Alphabet logic?

That doesn&#039;t make sense to me. What are you trying to do?

3. Dan
Senior Member
Join Date
Dec 1969
Posts
1,364

## RE: Alphabet logic?

i&#039;m trying to make an alphabetic menu... that looks like this:<BR><BR>A &#124 B &#124 C &#124 D ... etc... except all the letters are links.<BR><BR>rather than type each one out individually, with each individual link and all, i figure that it would be easier (and cooler) to have a for-next loop that does it for me... but i&#039;m not sure how. So i&#039;d need something like this (roughly)<BR><BR>For I=A to Z<BR><BR>&#060;A HREF="blah.asp?letter=I&#062;I&#060;/A&#062;<BR><BR>Next<BR><BR>Thats pretty much it.. thanks

4. Dalibor Sver Guest

## The answer is use ASCII codes

So you&#039;ll have<BR><BR>for i=65 to 90 &#039;for uppercase<BR>&#039; or you can use 97 to 122 for lowercase<BR>response.write chr(i)<BR>next

5. Medieval Dude Guest

## RE: Alphabet logic?

There are a number of ways to do this. I&#039;ll submit my suggestion:<BR><BR>&#060;%Dim i<BR>Dim alphabet<BR>alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"<BR><BR>For i = 1 to 26%&#062;<BR>&#060;A HREF="blah.asp?letter=&#060;%=mid(alphabet, i, 1)%&#062;&#060;/a&#062;<BR>&#060;%Next%&#062;

6. Senior Member
Join Date
Dec 1969
Posts
11,334

## This one gets my vote

No arrays, no strings.

7. Dalibor Sver Guest

## Did you know...

...that Bill suspected we are same person?<BR>

8. Senior Member
Join Date
Dec 1969
Location
Los Angeles, CA
Posts
21,192

## hmmmm...

...would an array be even the slighest slower??<BR>

9. Senior Member
Join Date
Dec 1969
Posts
11,334

## RE: Did you know...

No, where at?

10. Senior Member
Join Date
Dec 1969
Posts
11,334

## Probably not

But why type out 26 letters if you can have the loop do it for you?

#### Posting Permissions

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