内容如下我一开始想分块对一位、二位、三位进行猜解,例如
function onlynum(str)
'一位
for i=0 to 9
if md5(i)=str then
onlynum=i
exit function
end if
'二位
for i=0 to 9
for j= 0 to 9
tempnum=i & j
if md5(tempnum)=str then
onlynum=i
exit function
end if
next
next
'三位
....
end function这样下去到十几二十位就非常长了,不知有没有好的方法?
function onlynum(str)
'一位
for i=0 to 9
if md5(i)=str then
onlynum=i
exit function
end if
'二位
for i=0 to 9
for j= 0 to 9
tempnum=i & j
if md5(tempnum)=str then
onlynum=i
exit function
end if
next
next
'三位
....
end function这样下去到十几二十位就非常长了,不知有没有好的方法?
Dim i As Integer, n As Integer, num
For i = 1 To Len(str)
n = 10 ^ i - 1
For num = 0 To n
If md5(num) = str Then Exit For
Next
Next
End Function如果有十几二十位,就不必再算了
其实照你的意思,好像就是在一个
元素很大的数组中找到一个值为str的数组索引。