Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


Increment Through the Alphabet

 Keywords:  

Question:

I'd like to make a For loop that allows me to increment a letter that starts at a and ends as z

Is there a nice algorithm I can use within WinBatch to do this, or would it be easier to make a 2D array to act as a lookup table?

Answer:

You could use:
For xx=1 To 26
    letter=Num2Char(xx+64)
    Pause("Letter",letter)
Next

or

letters="abcdefghijklmnopqrstuvwxyz"
For xx=1 To 26
   letter=StrSub(letters,xx,1)
   Pause("Letter",letter)
Next