Microsoft VBScript 运行时错误 错误 '800a0009' 下标越界: '[number: 1]',行 1934
这是在1934行附近的代码FunctionPlayData2Json2(playData)Dimx,y,i,j,ret,pn,ary,z,l,k,r,p,t,q,it,f...
这是在1934行附近的代码
Function PlayData2Json2(playData)
Dim x,y,i,j,ret,pn,ary,z,l,k,r,p,t,q,it,f:x=split(playData,"$$$"):l=UBound(x):ary=array():f=array():r=array():ret=array("[%s]",0,array(),array()):k=0
for i=0 to l
y=split(x(i),"$$"):z=getPlayerIntroOnCache("play",y(0))
if Instr(z,"maxcc__0")<1 then
Redim Preserve f(k):f(k)=y(0)
y(0)="'"&y(0)&"'":pn=split(y(1),"#"):t=array():q=array():it=0
for j=0 to UBound(pn)
p=Instr(pn(j),"$")
if p>0 then
Redim Preserve t(it):Redim Preserve q(it)
t(it)=pn(j):q(it)=mid(pn(j),1,p-1)
it=it+1
end if
next
y(1)=unescape(ReplaceStr(escape(Join(t,"','")),"%u","\u")):y(1)=ifthen(y(1)<>"","['"&y(1)&"']","[]")
Redim Preserve r(k):Redim Preserve ary(k)
r(k)="["&y(0)&","&y(1)&"]":ary(k)=q:k=k+1
end if
next
ret(1)=k-1:ret(2)=ary:ret(3)=f
ret(0)=Replace(ret(0),"%s",Join(r,","))
PlayData2Json2=ret
End Function 展开
Function PlayData2Json2(playData)
Dim x,y,i,j,ret,pn,ary,z,l,k,r,p,t,q,it,f:x=split(playData,"$$$"):l=UBound(x):ary=array():f=array():r=array():ret=array("[%s]",0,array(),array()):k=0
for i=0 to l
y=split(x(i),"$$"):z=getPlayerIntroOnCache("play",y(0))
if Instr(z,"maxcc__0")<1 then
Redim Preserve f(k):f(k)=y(0)
y(0)="'"&y(0)&"'":pn=split(y(1),"#"):t=array():q=array():it=0
for j=0 to UBound(pn)
p=Instr(pn(j),"$")
if p>0 then
Redim Preserve t(it):Redim Preserve q(it)
t(it)=pn(j):q(it)=mid(pn(j),1,p-1)
it=it+1
end if
next
y(1)=unescape(ReplaceStr(escape(Join(t,"','")),"%u","\u")):y(1)=ifthen(y(1)<>"","['"&y(1)&"']","[]")
Redim Preserve r(k):Redim Preserve ary(k)
r(k)="["&y(0)&","&y(1)&"]":ary(k)=q:k=k+1
end if
next
ret(1)=k-1:ret(2)=ary:ret(3)=f
ret(0)=Replace(ret(0),"%s",Join(r,","))
PlayData2Json2=ret
End Function 展开
展开全部
每次使用split函数分割字符串成为数组后,都要判断一下数组的下标上限(即UBound,而下限LBound则是恒为0的),如果是在指定范围内才继续执行,否则就退出或提醒用户。比如:
y=split(x(i),"$$")
If UBound(y) = 1 Then
z=getPlayerIntroOnCache("play",y(0))
......
......
Else
MsgBox ""
End If
否则的话,如果遇到x(i)中没有$$,或者是个空串,那么后面的y(1)就肯定会提示下标越界了(空串则y(0)都会出错)!
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询