Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Reverse search and case-insernsitive search routines
#5
But your example is SEEDLESS. Great if you're growing grapes, but let's not wine about it...

Code: (Select All)
'        1111111111222222222233333333
'1234567890123456789012345678901234567
'c:\root\mystuff\basic\qb64\myfile.bas
file$ = "c:\root\mystuff\basic\qb64\myfile.bas"
seed% = 1
Do
    next_to_last$ = Mid$(file$, _InStrRev(Len(file$) - seed%, file$, "\") + 1)
    Print seed%, next_to_last$
    seed% = Len(next_to_last$) + 1
Loop Until seed% > Len(file$)
Print
seed% = Len(file$)
Do
    next_to_last$ = Mid$(file$, _InStrRev(seed%, file$, "\") + 1)
    Print seed%, next_to_last$
    seed% = _InStrRev(seed%, file$, "\") - 1
Loop Until seed% < 0
End

So a couple of chop methods, but my initial contention was when we count in reverse, we should seed in reverse. I let that go, because there is at least a since of continuity that even though the searching part of the string has been reversed, the seeding order, from beginning to end, remains constant.

Pete
Reply


Messages In This Thread
RE: Reverse search and case-insernsitive search routines - by Pete - 04-04-2024, 03:29 AM



Users browsing this thread: 1 Guest(s)