(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 String
' be sure to to add Chr$(10) to assure catching the first word from dictionary
words = Chr$(10) + _ReadFile$("Collins.txt") ' Steve fix to catch first word at line start
Do
Input "Enter word to lookup "; lookup$
result$ = FindWord$(lookup$)
If result$ = "" Then Print lookup$; " Not Found." Else Print result$
Print
Loop Until lookup$ = ""
Function FindWord$ (wrd$) ' thanks mdijkens and Steve fix to assure start of line
fpos& = InStr(words, Chr$(10) + UCase$(wrd$) + Chr$(9)) ' Steve fix to catch first word at line start
If fpos& > 0 Then
fpos& = fpos& + Len(wrd$) + 2
eol& = InStr(fpos&, words, Chr$(13))
FindWord$ = Mid$(words, fpos&, eol& - fpos&)
End If
End Function
It still can't find Steve.
b = b + ...