I am having a problem with the InStr command in the following code:
Dim Pos as Integer
//Check for Justaposition on the left
//Checks for a number before the '(' and inserts a '*' if appropriate
Pos=-1
Do //This loop works fine
Pos=Pos+2
Pos=InStr(Pos,ProbStr,"(")
If Pos>1 Then
perform some process here
End If
Loop Until Pos=0
//Check for Justaposition on the right
//Checks for a number after the ')' and inserts a '*' if appropriate
Pos=-1
Do //This loop does not work all the time
Pos=Pos+2
Pos=InStr(Pos,ProbStr,")") //<===Problem occurs here
If Pos>1 Then
perform some process here
End If
Loop Until Pos=0
ProbStr is a string property.
If ProbStr=(2+1/2)+(3+1/4) both loops work correctly.
If ProbStr=Dec(2+1/2)+Dec(3+1/4), the second loop does not exit because
Pos never goes to zero.
In the second loop, Pos=InStr(Pos,ProbStr,")")=21 the second time
through, then loop and Pos=Pos+2=23, but when it hits
Pos=InStr(Pos,ProbStr,")") again, Pos is set to 21 instead of zero. If
I manually change the command to Pos=InStr(23,ProbStr,")"), it works
fine and returns a zero.
Anyone have a hint as to what I am doing wrong or why it does not work?
Thanks,
Aubrey
PB G4 Mac OS 10.3.3
RB 5.2.4
_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|