为下一步添加经典asp

For next to add with classic asp

下一个 "A to Z" 得到结果。 为了进入; 5 和数字 6,我想补充一下。 怎么做。

for k = asc("A") to asc("Z")
response.write chr(k)
next

结果:

一个 乙 C .. Z

我要 一个 乙 C .. Z 5个 6

例如( k = asc("A") 到 asc("Z") 添加“5”并添加“6”)

谢谢。

strString = "ABCDEFGHIJKLMNOPQRSTUVWXYZ56"
For i=1 To Len(strString)
    Response.Write Mid(strString,i,1)
Next

你不能真的有一个循环,只需添加单独的命令:

for k = asc("A") to asc("Z")
    response.write chr(k)
next
response.write "5"
response.write "6"

另一种选择是将所有 ASCII 数字存储在数组中,然后循环该数组:

Dim arrLetters(), x
ReDim arrLetters(-1)
For k=Asc("A") To Asc("Z")
    ReDim Preserve arrLetters(UBound(arrLetters) + 1)
    arrLetters(UBound(arrLetters)) = k
Next
ReDim Preserve arrLetters(UBound(arrLetters) + 1)
arrLetters(UBound(arrLetters)) = Asc("5")
ReDim Preserve arrLetters(UBound(arrLetters) + 1)
arrLetters(UBound(arrLetters)) = Asc("6")
For x=0 To UBound(arrLetters)
    k = arrLetters(x)
    response.write chr(k)
Next
Erase arrLetters