>> Check Delphi help on the function: pos >> and the function: StrPos >> >> pos return the first occurance of a string within another string. >> StrPos does the same thing for a PChar string. >> If you want to perform this search on a file, you simply read >> through the file and use these functions to examine lines >> (or blocks) of the of file. >> >> HTH, >> >> Glenn Lawler >> www.incodesystems.com >> > > >Nope, I have tried it and it wont work with large buffer > 64k. And it >not fast enough :) >Am I wrong ?
I have not tried either function with a buffer larger than 64k, but I do not have any reason to believe they would not work. However, that begs the question: why would you want to use such a large buffer? I suspect that if you bench mark this you will find that any buffer size larger than around 16k will not improve performance. Both pos and StrPos are brute force searches. One of the fastest available general purpose search algorithms is Boyer-Moore: http://en.wikipedia.org/wiki/Boyer-Moore_string_search_algorithm If you are searching really large files repeatedly, you should think about implementing a full text search index approach instead of repeatedly searching the same files. Glenn Lawler www.incodesystems.com

