Friday, July 31, 2009

I want to use ASP to loop through a set of characters. For i = a to f. How do I do this?

Essentially I want to loop though a set of characters?

I want to use ASP to loop through a set of characters. For i = a to f. How do I do this?
for i = asc("a") to asc("f")


character = chr(i)


' do something with character


next
Reply:for c as Char = "a"C to "f"C





' loop body





next for





That should work, characters are just integers. You declare characters like strings of 1 length, and the capital C after them indicates they are characters (not strings). VB syntax is so janky....
Reply:Dim iterate


for iterate = a to f


'Do Something


next





VB.Net-%26gt;


for iterate as integer = a to f


'Do Something


next





c#


for (int x = a; x %26lt; f+1;x++)


{


}
Reply:search on ask.com
Reply:A "for loop" requires you to use a numeric variable





what you do is set the the variable to numbers in the character


values


simple ascii table will give you values


you then convert the number to a $variable single letter


with the appropriate command





As converting variables to numbers and numbers to alpha


numeric is part of the very early hours of programming


you may want to ask slightly more complicated questions


in the future to appear to know what you are doing


No comments:

Post a Comment