Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Day 024: LCASE$
#10
@SMcNeill

So something along the lines of this using indexing. Interesting...

Code: (Select All)
search$ = "moose"
a$ = "Dog Cat Rabbit Moose Elephant Bear Tiger Fish "

' Create the indexing for this demo...
FOR i = 0 TO LEN(a$)
    j = j + 1: last = j
    IF MID$(a$, i, 1) = " " OR i = 0 THEN
        cnt = cnt + 1
        REDIM _PRESERVE index(cnt), size(cnt)
        index(cnt) = i + 1
        size(cnt - 1) = j - 1: j = 0
    END IF
NEXT
size(cnt) = last - 1

' For fun, print the index and size values...
FOR i = 1 TO UBOUND(index)
    PRINT i; index(i); size(i)
NEXT

' Read and search using this indexing method.
i = 0
DO
    i = i + 1
    IF search$ = LCASE$(MID$(a$, index(i), size(i))) THEN found = 1: EXIT DO
LOOP
IF found THEN PRINT "Found: "; search$ ELSE PRINT "No search results.."


Pete
Shoot first and shoot people who ask questions, later.
Reply


Messages In This Thread
Day 024: LCASE$ - by Pete - 12-04-2022, 05:17 AM
RE: Day 024: LCASE$ - by mnrvovrfc - 12-04-2022, 12:01 PM
RE: Day 024: LCASE$ - by luke - 12-04-2022, 01:25 PM
RE: Day 024: LCASE$ - by SMcNeill - 12-04-2022, 01:48 PM
RE: Day 024: LCASE$ - by mnrvovrfc - 12-04-2022, 05:57 PM
RE: Day 024: LCASE$ - by SMcNeill - 12-04-2022, 10:47 PM
RE: Day 024: LCASE$ - by Pete - 12-04-2022, 04:10 PM
RE: Day 024: LCASE$ - by Pete - 12-04-2022, 06:47 PM
RE: Day 024: LCASE$ - by SMcNeill - 12-04-2022, 11:16 PM
RE: Day 024: LCASE$ - by Pete - 12-05-2022, 12:59 AM
RE: Day 024: LCASE$ - by luke - 12-05-2022, 07:30 AM
RE: Day 024: LCASE$ - by mnrvovrfc - 12-05-2022, 08:24 AM
RE: Day 024: LCASE$ - by Pete - 12-05-2022, 10:38 AM



Users browsing this thread: 5 Guest(s)