The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



FindFirstMatchInTextFile


Unit: SDL_filesys
Class: none
Declaration: function FindFirstMatchInTextFile (FName: string; SearchExp: string; IgnoreCase: boolean; var MatchedLine: string): integer;

The function FindFirstMatchInTextFile searches the text file of name FName for the presence of the string SearchExp. The parameter IgnoreCase determines whether the search is case sensitive. The search is a simple text search (no wildcards or regular expressions supported). The file must not be open.

The function returns a zero value if the searched string is not present in the file. If the search string has been found, the variable parameter MatchedLine returns the line which contains the matched search expression. The function value is the index of the first character of the search expression in the parameter MatchedLine.

Hint: Please note that this function is intended to be applied to text files only. Searching a binary file may return unexpected results. Further, searching long text files may result in considerable time requirements (especially if the search expression is not contained).



Last Update: 2012-Oct-20