请问为什么会下标越界?
vb吧
全部回复
仅看楼主
level 1
笑依青楼 楼主
2008年12月05日 13点12分 1
level 0
粗略看了一下代码,估计是i的值超出了Index的下标for i=1 to len(str)-1 试一下百度的验证码输入框什么时候变得这么人性化了?
2008年12月05日 13点12分 2
level 1
笑依青楼 楼主
试了一下,仍然出错,应该不是那里的问题,查找的字符串为HTML,因为格式的原因,不可能到达尾部。 Dim n As Long Dim index1() As Long Dim index2() As Long Dim length3() As Long Dim oldname() As String Dim newname() As String str = LCase(strs) sIn1 = "target=_blank>
" sIn2 = "" n = InStrN(str, sIn1, index1) n = InStrN(str, sIn2, index2) Msgbox UBound(index1) ' 出错 '这里发现index1似乎已经不是数组,被释放掉了?? n = n - 1 ReDim length3(n) ReDim oldname(n) Dim i As Integer For i = 0 To n index1(i) = index1(i) + Len(sIn1) length3(i) = index2(i) - index1(i) oldname(i) = Mid(str, index1(i), length3(i)) Next
2008年12月05日 13点12分 3
1