At 11:41 AM -0700 5/27/04, Aubrey Todd wrote:
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
...
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.
You've verified this by stepping through it with the debugger?
If I manually change the command to Pos=InStr(23,ProbStr,")"), it
works fine and returns a zero.
In that case, there has to be a some sort of confusion here; there is
no difference to InStr between a literal 23 and a variable which
contains 23.
My guess is that the second time through the loop, Pos is not
actually equal to 21. Perhaps "perform some process here" is
accidentally clobbering the value of Pos.
Best,
- Joe
--
,------------------------------------------------------------------.
| Joseph J. Strout REAL Software, Inc. |
| joe at realsoftware dot com http://www.realsoftware.com |
`------------------------------------------------------------------'
_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|