★50分求解??为什么我的【ASP】如此这般???~~~~~

swordqj 2004-11-23 10:24:43
写了一个十进制导2进制的函数
function To102(sun)
dim B
For i = 1 To Len(hex(sun))
Select Case Mid(hex(sun), i, 1)
Case "0": B = B & "0000"
Case "1": B = B & "0001"
Case "2": B = B & "0010"
Case "3": B = B & "0011"
Case "4": B = B & "0100"
Case "5": B = B & "0101"
Case "6": B = B & "0110"
Case "7": B = B & "0111"
Case "8": B = B & "1000"
Case "9": B = B & "1001"
Case "A": B = B & "1010"
Case "B": B = B & "1011"
Case "C": B = B & "1100"
Case "D": B = B & "1101"
Case "E": B = B & "1110"
Case "F": B = B & "1111"
End Select
Next
To102=B
end function


response.write To102(3)
的时候很正常


for i=1 to 3
response.write To102(i)
next
的时候

速度死慢,请问为什么???
...全文
56 点赞 收藏 2
写回复
2 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
lienzhu 2004-11-23
function To102(sun)
dim B
hexnum=hex(sun)
length=len(hexnum)
For i = 1 To length
Select Case Mid(hexnum, i, 1)
Case "0": B = B & "0000"
Case "1": B = B & "0001"
Case "2": B = B & "0010"
Case "3": B = B & "0011"
Case "4": B = B & "0100"
Case "5": B = B & "0101"
Case "6": B = B & "0110"
Case "7": B = B & "0111"
Case "8": B = B & "1000"
Case "9": B = B & "1001"
Case "A": B = B & "1010"
Case "B": B = B & "1011"
Case "C": B = B & "1100"
Case "D": B = B & "1101"
Case "E": B = B & "1110"
Case "F": B = B & "1111"
End Select
Next
To102=B
end function

for n=1 to 3
response.write To102(n)
next

如果在外面用i,那么i是全局变量,和函数中i冲突,可能赵成死循环
回复
lienzhu 2004-11-23
我的10进制转2进制函数:
Function N10To2(num)
Dim tmp
tmp = ""
Do While num > 1
tmp = (num Mod 2) & tmp
num = num \ 2
Loop
tmp = num & tmp
N10To2 = tmp
End Function


回复
相关推荐
发帖
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
帖子事件
创建了帖子
2004-11-23 10:24
社区公告
暂无公告