So brainstorming a bit here... which reminds me, buy Flex Tape...
The QB64 IDE keeps your entire code as a string, if I remember correctly. So I wanted to see what would be the faster way to search our code with LCASE$()
So I did some speed tests and it appears Method #1 is the winner by a factor of 5 or more.
Waiting for Steve to post... Why Method #3, of course!... and give the IDE method or somethong he came up with. (Spelling mistake intentional).
Pete
The QB64 IDE keeps your entire code as a string, if I remember correctly. So I wanted to see what would be the faster way to search our code with LCASE$()
Code: (Select All)
' Method #1
a$ = "Dog Cat Rabbit Moose Elephant Bear Tiger Fish "
search$ = "moose"
IF INSTR(LCASE$(a$), search$) THEN PRINT "Found: "; search$ ELSE PRINT "No search results.."
' Method #2
DO
j% = INSTR(seed%, a$, " ")
IF j% = 0 THEN EXIT DO
IF LCASE$(MID$(a$, seed%, j% - seed%)) = search$ THEN EXIT DO
REM PRINT "|" + LCASE$(MID$(a$, seed%, j% - seed%)) + "|", search$ ' Show parsing...
seed% = j% + 1
LOOP
IF j% THEN PRINT "Found: "; search$ ELSE PRINT "No search results.."
So I did some speed tests and it appears Method #1 is the winner by a factor of 5 or more.
Waiting for Steve to post... Why Method #3, of course!... and give the IDE method or somethong he came up with. (Spelling mistake intentional).
Pete