ASCII TEXT SEARCH +

 BBS: Inland Empire Archive
Date: 03-29-93 (11:12)             Number: 296
From: JANUSZ SUCHOROLSKI           Refer#: NONE
  To: ALL                           Recvd: NO  
Subj: ASCII TEXT SEARCH +            Conf: (2) Quik_Bas
I'd like to implement a "text search" while inside ASCII file.
Here's some code:
CLS
INPUT "Text search: ", ts$
ts$ = UCASE$(ts$)
OPEN "my_file.txt" FOR INPUT AS #1
        LineNum = 0
   WHILE NOT EOF(1)
        LineNum = LineNum + 1
           INPUT #1, Check$

        IF INSTR(UCASE$(Check$), ts$) THEN

           LOCATE 12, 1
           COLOR 0, 7
           MID$(Check$, INSTR(UCASE$(Check$), ts$)) = UCASE$(ts$)
           PRINT Check$
           LOCATE 22, 1
           PRINT "Found in ", LineNum
           COLOR 7, 0
           DO
             Ky$ = INKEY$
           LOOP WHILE Ky$ = ""

           CLS
        END IF
   WEND

        PRINT "No more matches, try again..."
========================== the end =======================
It simply shows the whole line in reverse video, however I'd like to see
just the occurence(s) of the string highlighted instead of the whole
line. I guess somebody did it before and might post a missing
bit(bytes).
Thanx, Janusz (John) Suchorolski TOPNET BBS (403) 241-8911
--- PcBoard 14.5U
 * Origin: 24 Lines, ZyXEL's (403)299-9900 (1:134/10)
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