Searching in text.. 
Author Message
 Searching in text..

Hi All,

I'm new to this group and perhaps this question has been answered before but..

I'm having a little problem with Pascal (i'm using TP 6.0 and TPfW 1.5). I want
to do a search in textfiles, and the files can vary from a few kb's to over 1
Mb. I want to do a search on a (part of) a sentence or word in a string. The
length of a string can be very long (maybe *that* might cause problems?). The
problem has been solved in QBasic this way:

 >         AANTALREGELS = 0
 >         LOCATE 3, 1: INPUT "==> Zoeken naar "; zoek$
 >         IF zoek$ = "" THEN GOTO VRAAGNAAM
 >         COLOR 7, 4: LOCATE 3, 57: PRINT "[ Zoeken...]":
 >         DO
 >           LINE INPUT #2, regel$
 >           uzoek$ = UCASE$(zoek$)
 >           uregel$ = UCASE$(regel$)
 >           IF INSTR(uregel$, uzoek$) THEN GOSUB PRINTREGEL
 >           LOOP UNTIL EOF(2)

etc..

I want to rewrite this to Pascal-code. A time ago someone helped me out with
code for TP 6.0, but.. my HD crashed and i lost his tip(s).. (i do backups once
a week, this time once a week was 3 days to late ).

I would like to know how to solve this.. I've seen (and tryed) information
on several search-methods, but the info is in (difficult to understand)
English and not detailed enough. I just can't figure out how to do this.
It doesn't have to be *fast*, it has to *work* properly.
My manuals are good, but in English also :-((

Let me know please (and please don't send me responses like "try the
BM-method", that just isn't enough for me, sorry).

Greetings,
       Rudy.

  + --------------------------------------------------------------------- +
  | Bijbel Aktueel +31(0)594-505612 (28k8) | CMNet/SigNet/InterNet Mail   |

  + --------------------------------------------------------------------- +



Wed, 18 Jun 1902 08:00:00 GMT  
 Searching in text..

Quote:

>Hi All,

>I'm new to this group and perhaps this question has been answered
before but..

>I'm having a little problem with Pascal (i'm using TP 6.0 and TPfW
1.5). I want
>to do a search in textfiles, and the files can vary from a few kb's to
over 1
>Mb. I want to do a search on a (part of) a sentence or word in a
string. The
>length of a string can be very long (maybe *that* might cause
problems?). The
>problem has been solved in QBasic this way:

> >         AANTALREGELS = 0
> >         LOCATE 3, 1: INPUT "==> Zoeken naar "; zoek$
> >         IF zoek$ = "" THEN GOTO VRAAGNAAM
> >         COLOR 7, 4: LOCATE 3, 57: PRINT "[ Zoeken...]":
> >         DO
> >           LINE INPUT #2, regel$
> >           uzoek$ = UCASE$(zoek$)
> >           uregel$ = UCASE$(regel$)
> >           IF INSTR(uregel$, uzoek$) THEN GOSUB PRINTREGEL
> >           LOOP UNTIL EOF(2)

>etc..

>I want to rewrite this to Pascal-code. A time ago someone helped me
out with
>code for TP 6.0, but.. my HD crashed and i lost his tip(s).. (i do
backups once
>a week, this time once a week was 3 days to late ).

>I would like to know how to solve this.. I've seen (and tryed)
information
>on several search-methods, but the info is in (difficult to
understand)
>English and not detailed enough. I just can't figure out how to do
this.
>It doesn't have to be *fast*, it has to *work* properly.
>My manuals are good, but in English also :-((

>Let me know please (and please don't send me responses like "try the
>BM-method", that just isn't enough for me, sorry).

>Greetings,
>       Rudy.

>  +

--------------------------------------------------------------------- +
Quote:
>  | Bijbel Aktueel +31(0)594-505612 (28k8) | CMNet/SigNet/InterNet
Mail   |
>  | PO Box 113, 9800 AC Zuidhorn, Holland  | Email:


Quote:
>  +

--------------------------------------------------------------------- +

Quote:

>> try something like:-

    for j := 1 to length(searchfor) do
           searchfor[j] := upcase(searchfor[j]);
    readln(infile,buff);
    while length(buff) > 0 do
    begin
      for j := 1 to length(buff) do buff[j] := upcase(buff[j]);
      j := pos(searchfor,buff);
      if j > 0 then writeln('Found search argument in file');
      readln(infile,buff);
    end;

- Show quoted text -

Quote:

>> Martin



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Search for text string in a text file

2. Search for text string in a text file

3. Searching Rich text in Blob fields

4. Searching a text file

5. searching: Source text

6. searching a text file

7. Search for text in Memos using Query?

8. Need help searching for text in a DBMemo through multiple records

9. Local SQL - Can you search for text contained in a field

10. Need help searching for text in a DBMemo through multiple records ..

11. Full text search

12. Where to find text search algorithms?

 

 
Powered by phpBB® Forum Software