如何跳出内循环
Function orgCode(vLength)Dim MyArray,MyString,vStr,vArr, Msg
MyString = "***********"
MyArray = Split(MyString, ",", -1, 1)
For i = 1 To len(vLength)
vStr = Mid(vLength, i, 1)
For j = 0 To 61
vArr = MyArray(j)
If Trim(vStr) = Trim(vArr) Then
Msg =Msg & MyArray(j)
exit for
End If
Next
Next
If Trim(vLength) = Trim(Msg) Then
Reporter.ReportEvent micPass,"提示","********"
Else
Reporter.ReportEvent micPass,"提示","********"
End If
End Function
调用方法 orgCode(Len1) ,Len1=9,请问如何在Trim(vStr) = Trim(vArr)时跳出内循环,使脚本的效率提高?
For j = 0 To 61
vArr = MyArray(j)
If Trim(vStr) = Trim(vArr) Then
Msg =Msg & MyArray(j)
exit for
End If
Next
你这EXIT FOR不是已经跳出内循环了吗?? 哦,那个Exit For 是我试试用的,结果是加了后跳出整个循环了 换一种循环,一个用while一个用for或者一个用do就好控制了 请问应该怎么写啊,想不清楚了 For i = 1 To len(vLength)
vStr = Mid(vLength, i, 1)
j = 0
Do While j < 62
vArr = MyArray(j)
If Trim(vStr) = Trim(vArr) Then
Msg =Msg & MyArray(j)
Exit do
Else
j = j + 1
End If
Loop
Next 呵呵,谢谢啊,比前面效率要高了
页:
[1]