Text search routine

 BBS: Inland Empire Archive
Date: 03-10-92 (21:01)             Number: 159
From: TOM HAMMOND                  Refer#: NONE
  To: TRENT SHIRLEY                 Recvd: NO  
Subj: Text search routine            Conf: (2) Quik_Bas
TS>file for any given word or text string.  I need the search
TS>to be Case indifferent and was hoping that someone out
TS>there had a routine, or shareware/freeware library routine...

Someone sent a message a while back which described a pretty easy (and
what should be VERY FAST) method of doing such a search... I think it
may have been Matt Hart... lemme see if I still have it... ah, yes, here
it is... let's see if I can possibly format it into a bit more easily
readable form... it's not a source code listing, but it's certainly a
good set of pseudocode from which you can work...

Hope this helps.

good Luck from  Tom Hammond  (N0SS)


Date: 02-04-92 (10:09)             Number: 5286
From: MATT HART                    Refer#: NONE
  To: FRANK DIDIK                   Recvd: NO
Subj: HASH FILES                     Conf: (13) QuickBasic

QB can open a sequential file as binary and do a search using the largest available buffer size, then find the beginning an ending line very quickly. Once the seq file is created, open as binary, get records into a string of say 10K, do an INSTR(Strg$,SearchStrg$). If not found, do a SEEK from the current position back the length of the search string (so as not to miss it if is was in between the 10K boundaries), then continue the search. When found, SEEK backwards 2 bytes at a time until a CHR$(13)+CHR$(10) is found, then GET the record, set FinalStrg$ = LEFT$(Record$,INSTR(Record$,CHR$(13)+CHR$(10))) and you'll have that line as it was PRINTed to a sequential file, but VERY fast. --- WM v2.00/91-0231 * Origin: The Modem Zone BBS (314) 893-5106 (1:289/2)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET