Actions
Bug #347
closedFunction problem. The third time any user-defined function is called, AOZ will lock up.
Start date:
04/18/2020
Due date:
% Done:
0%
Estimated time:
Affected version:
Description
In the following example, I'm trying to re-define Instr to allow for a negative startingPosition parameter.
The function works fine with any one or two of the following.
If, however, the function is called a third time, the program will freeze.
Function "instr",st$,fnd$,strt
result=0
If Abs(strt)<=Len(st$)
If strt < 0
startPos=Len(st$)-(abs(strt)-1)
For p=startPos to 1 Step -1
If Mid$(st$,p,Len(fnd$))=fnd$ Then result=p:Exit
Next p
Else
For p=strt To Len(st$)
If Mid$(st$,p,Len(fnd$))=fnd$ Then result=p:Exit
Next p
End If
End If
End Function(result)
Any one or two of the following examples will work fine, but if you try a third one AOZ will freeze.
Print instr(inst$," ",1) ' result 5
Print instr(inst$," ",-1) ' result 35
Print instr(inst$," ",6) ' result 10
Print instr(inst$," ",-8) ' result 29
Print instr(inst$," ",40) ' result 0
Print instr(inst$," ",-40) ' result 0
Actions