
02-01-2003, 02:33 PM
|
 |
Coder of Fortune
Retired Leader * Expert *
|
|
Join Date: Dec 2002
Location: Troy, NY USA
Posts: 3,120
|
|
Well, the easiest (and least efficient) method would be something like this:
Code:
for i=1 to len(ofthefile)
if instr(filetext$,searchtext$) then file_is_good
next i
Of course, that just finds a particular string in order. If you want to have all of a bunch of words not necessarily in order, you need to do this for the if:
Code:
if instr(filetext$,searchtext$(1)) and instr(filetext$,searchtext$(2) ... then file_is_good
To do whole word search, you can put spaces on the beginning and end of words, and hope that they aren't at the end of a sentence. You could also do an or search for spaces at end or punctuation at end, or replace all punctuation with spaces before the search. You could probably also drive Word with your program to do the search with the preexisting search capabilities of Word.
Do note that this is the easiest to code, yet crudest, least efficient search routine I could come up with in 3 minutes. A search of the forum or google will probably give you a combnation of brilliant VB code and API calls.
|
__________________
-- The Gavster
Like to IRC? Try irc.randomirc.com
GavServer
|