03-01-2024, 03:10 PM
words = CHR$(10) + _ReadFile("Collins.txt")
|
How to format a While... Wend correctly?
|
|
03-01-2024, 03:10 PM
words = CHR$(10) + _ReadFile("Collins.txt")
(03-01-2024, 03:10 PM)SMcNeill Wrote: words = CHR$(10) + _ReadFile("Collins.txt") of course! so simple rechecking now...This is working well for the few tests I gave it: Code: (Select All) Dim Shared words As StringIt still can't find Steve.
724 855 599 923 575 468 400 206 147 564 878 823 652 556 bxor cross forever
03-02-2024, 03:24 AM
WHILE "Pete" > "$teve"
PRINT "Help, I'm stuck in an infinite loop!" WEND Pete
03-02-2024, 03:51 AM
(This post was last modified: 03-02-2024, 03:55 AM by PhilOfPerth.)
I haven't analyzed all those listings, but this seems to me to be the simplest search:
Code: (Select All) Open "RA.txt" For Random As #1 Len = 11... using the binary search that bplus showed (amended/maybe corrupted a bit). Works for me, anyway, including AA, ZEBRA, ZZZS and CAT! (RA.txt is an RA file with len = 11)
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, Western Australia.)
![]() Please visit my Website at: http://oldendayskids.blogspot.com/
@PhilOfPerth I have tested the method above and have to say I have been converted.
1. you don't have to do anything to Collins.txt but you could add an extra line first, no big deal if you don't. So no 2 RA files needed nor do you have to keep at least one RA file open while the program is running, not the greatest to have a file open when you quit though unlikely to do any damage. The entire file is loaded into a very long string and done in one giant gulp! You now have the contents accessible by RAM not file access, much faster. 2. Just look how it finds a word, it uses INSTR() ONCE because we enclose the word with a chr$(10) at front and a Chr$(9) on end to guarantee the words we find are the first on any line of Collins.txt file. It does use INSTR() again just to find the end of that particlar line. So there is no playing of the guessing game that we do with an RA file. It's pretty cool efficiency wise.
724 855 599 923 575 468 400 206 147 564 878 823 652 556 bxor cross forever
|
|
« Next Oldest | Next Newest »
|
| Possibly Related Threads… | |||||
| Thread | Author | Replies | Views | Last Post | |
| Need some help getting characters to follow each other correctly | Cobalt | 6 | 1,071 |
11-22-2024, 01:19 AM Last Post: Cobalt |
|
| Trasparent color not being set correctly here... | Dav | 9 | 1,565 |
11-10-2024, 04:11 AM Last Post: bplus |
|
| SHELL creates unicode file, can't read correctly with LINE INPUT | thesolarcode | 3 | 1,248 |
05-06-2023, 09:41 PM Last Post: thesolarcode |
|