asp for 循环问题,求人指教!
代码如下:<%
ww="1DV3695,1DV3696,1DV3697,"
zz=split(ww,",")'分组
for n=0 to ubound(zz)-1
aa=trim(zz(n))'将ww里的值 逐一取出来
'下面这段的是32进制的算法
for t=1 to len(aa)
sn=mid(aa,t,1)'将ww里的值取出后 逐个 字母或是数字 转换成十进制
for f=1 to len(cstr(sn))
if ucase(MID(sn,f,1))="A" then
number_32="10"*32^(len(cstr(sn))-f)
else
if ucase(MID(sn,f,1))="B" then
number_32="11"*32^(len(cstr(sn))-f)
else
if ucase(MID(sn,f,1))="C" then
number_32="12"*32^(len(cstr(sn))-f)
else
if ucase(MID(sn,f,1))="D" then
number_32="13"*32^(len(cstr(sn))-f)
else
if ucase(MID(sn,f,1))="E" then
number_32="14"*32^(len(cstr(sn))-f)
else
if ucase(MID(sn,f,1))="F" then
number_32="15"*32^(len(cstr(sn))-f)
else
if ucase(MID(sn,f,1))="G" then
number_32="16"*32^(len(cstr(sn))-f)
else
if ucase(MID(sn,f,1))="H" then
number_32="17"*32^(len(cstr(sn))-f)
else
if ucase(MID(sn,f,1))="J" then
number_32="18"*32^(len(cstr(sn))-f)
else
if ucase(MID(sn,f,1))="K" then
number_32="19"*32^(len(cstr(sn))-f)
else
if ucase(MID(sn,f,1))="L" then
number_32="20"*32^(len(cstr(sn))-f)
else
if ucase(MID(sn,f,1))="M" then
number_32="21"*32^(len(cstr(sn))-f)
else
if ucase(MID(sn,f,1))="N" then
number_32="22"*32^(len(cstr(sn))-f)
else
if ucase(MID(sn,f,1))="P" then
number_32="23"*32^(len(cstr(sn))-f)
else
if ucase(MID(sn,f,1))="R" then
number_32="24"*32^(len(cstr(sn))-f)
else
if ucase(MID(sn,f,1))="S" then
number_32="25"*32^(len(cstr(sn))-f)
else
if ucase(MID(sn,f,1))="T" then
number_32="26"*32^(len(cstr(sn))-f)
else
if ucase(MID(sn,f,1))="U" then
number_32="27"*32^(len(cstr(sn))-f)
else
if ucase(MID(sn,f,1))="V" then
number_32="28"*32^(len(cstr(sn))-f)
else
if ucase(MID(sn,f,1))="W" then
number_32="29"*32^(len(cstr(sn))-f)
else
if ucase(MID(sn,f,1))="X" then
number_32="30"*32^(len(cstr(sn))-f)
else
if ucase(MID(sn,f,1))="Y" then
number_32="31"*32^(len(cstr(sn))-f)
else
number_32=MID(sn,f,1)*32^(len(cstr(sn))-f)
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
next
'算法解说,如1DV3695 要求1*7,D*6,v*5。。。。5*1,然后求和
'也就是将其32进制转换成10 进制后求和:1*7+13*6+28*5+3*4+6*3+9*2+5*1
dd=dd&number_32&"*"&len(aa)-(t-1)&","
cc=cc+number_32*(len(aa)-(t-1))
next
Response.Write(dd&"<br>")
next
%>
运行结果是:
1*7,13*6,28*5,3*4,6*3,9*2,5*1,
1*7,13*6,28*5,3*4,6*3,9*2,5*1,1*7,13*6,28*5,3*4,6*3,9*2,6*1,
1*7,13*6,28*5,3*4,6*3,9*2,5*1,1*7,13*6,28*5,3*4,6*3,9*2,6*1,1*7,13*6,28*5,3*4,6*3,9*2,7*1,
我希望的是 如下格式 求和!
1*7,13*6,28*5,3*4,6*3,9*2,5*1,
1*7,13*6,28*5,3*4,6*3,9*2,6*1,
1*7,13*6,28*5,3*4,6*3,9*2,7*1,
该如何编写??小弟先谢过!