内容如下我一开始想分块对一位、二位、三位进行猜解,例如
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这样下去到十几二十位就非常长了,不知有没有好的方法?

解决方案 »

  1.   

    “猜解”是“拆解”?对字符串进行拆解,可以用mid函数。
      

  2.   

    不太明白你的意思,试试:Function onlynum(str)
    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如果有十几二十位,就不必再算了
      

  3.   

    see:http://community.csdn.net/Expert/topic/4762/4762887.xml?temp=.2167627
      

  4.   

    md5()是什么意思?
    其实照你的意思,好像就是在一个
    元素很大的数组中找到一个值为str的数组索引。