To get out of for loop in QTP you must use Exit For Statement.
Exit For statement will break the for loop and execute first statement outside for loop.
Example -
Below code demonstrates the exit for use in QTP -
For ct = 1 to 3
TempNum = mid(Tempstr,ct,1)
If isnumeric(TempNum) Then
LengthNum = LengthNum &TempNum
Else
Exit For
End If
Next
GetStrLenNumber = LengthNum
Example -
Below code demonstrates the exit for use in QTP -
For ct = 1 to 3
TempNum = mid(Tempstr,ct,1)
If isnumeric(TempNum) Then
LengthNum = LengthNum &TempNum
Else
Exit For
End If
Next
GetStrLenNumber = LengthNum