以下代码将查出的结果存入memo2中,其中用于判断的函数为MyFinder
unit main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Memo1: TMemo;
Memo2: TMemo;
function MyFinder(a,b:string):boolean;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function TForm1.MyFinder(a,b:string):boolean;
var
i:integer;
begin
result:=false;
for i:=1 to 6 do
begin
if b='*' then a:='*';
end;
if a=b then result:=true;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
i:integer;
begin
memo2.Clear;
for i:=0 to memo1.Lines.Count-1 do
if myfinder(memo1.Lines.Strings,'1**4**') then
memo2.Lines.add(memo1.Lines.Strings);
end;
end.