Ver Mensaje Individual
  #2  
Antiguo 29-07-2007
Avatar de xEsk
[xEsk] xEsk is offline
Miembro Premium
 
Registrado: feb 2006
Posts: 454
Reputación: 19
xEsk Va por buen camino
Hola, yo las dos segundas funciones que has puesto, las hubiera hecho un poco más "sencillas":

Código Delphi [-]
uses SysUtils, Classes;

function FindInStr(Text, Destination: String; CaseSensitive: Boolean): Boolean;
begin
  if CaseSensitive then Destination:=LowerCase(Destination);
  Result:=Pos(Text, Destination) > 0;
end;

function FindInTextFile(Text, Filepath: String; CaseSensitive: Boolean): Boolean;
var
  AFile: TStringList;

begin
  if FileExists(Filepath) then
    begin
      AFile:=TStringList.Create;
      try
        AFile.LoadFromFile(FilePath);
        Result:=FindInStr(Text, AFile.Text, CaseSensitive);
      finally
        AFile.Free;
      end;
    end;
end;

Lo que ya no sé, es si tus funciones serán mas rápidas o no. Hay que probarlo.

Saludos!
Responder Con Cita