N
nnpxxiao
Unregistered / Unconfirmed
GUEST, unregistred user!
如有MEMO1,MEMO2两个控件!
MEMO1 想让 MEMO2
0 0
1 1
1 2
2
2
具体要求就是过滤掉MEMO1中重复的!
我的代码如下但就是不能实现,郁闷中`````[]
请高手修改```
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
Memo2: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
i,index,i1,index1:integer;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
check1,check2,check3,check4:string ;
begin
memo2.Clear ;
Memo1.Lines.LoadFromFile('C:/KQ/Backup/k070811175907_d03.txt');
self.Memo2.Lines.Add(self.Memo1.Lines.Strings[0]);
//showmessage(inttostr(self.Memo1.Lines.Count));
i:=self.Memo1.Lines.Count ;
index:=0;
while index<> i do
begin
check1:=copy(self.Memo1.Lines.Strings[index],0,6);
check2:=copy(self.Memo1.Lines.Strings[index],12,8);
//showmessage(check1+check2);
i1:=self.Memo2.Lines.Count ;
index1:=0;
while index1<> i1 do
begin
check3:=copy(self.Memo2.Lines.Strings[index1],0,6);
check4:=copy(self.Memo2.Lines.Strings[index1],12,8);
if (check1<>check3) and (check2<>check4) and ()then
begin
self.Memo2.Lines.Add(self.Memo1.Lines.Strings[index]);
i1:=self.Memo2.Lines.Count ;
end;
index1:=index1+1;
end;
index:=index+1;
end;
end;
end.
MEMO1 想让 MEMO2
0 0
1 1
1 2
2
2
具体要求就是过滤掉MEMO1中重复的!
我的代码如下但就是不能实现,郁闷中`````[]
请高手修改```
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
Memo2: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
i,index,i1,index1:integer;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
check1,check2,check3,check4:string ;
begin
memo2.Clear ;
Memo1.Lines.LoadFromFile('C:/KQ/Backup/k070811175907_d03.txt');
self.Memo2.Lines.Add(self.Memo1.Lines.Strings[0]);
//showmessage(inttostr(self.Memo1.Lines.Count));
i:=self.Memo1.Lines.Count ;
index:=0;
while index<> i do
begin
check1:=copy(self.Memo1.Lines.Strings[index],0,6);
check2:=copy(self.Memo1.Lines.Strings[index],12,8);
//showmessage(check1+check2);
i1:=self.Memo2.Lines.Count ;
index1:=0;
while index1<> i1 do
begin
check3:=copy(self.Memo2.Lines.Strings[index1],0,6);
check4:=copy(self.Memo2.Lines.Strings[index1],12,8);
if (check1<>check3) and (check2<>check4) and ()then
begin
self.Memo2.Lines.Add(self.Memo1.Lines.Strings[index]);
i1:=self.Memo2.Lines.Count ;
end;
index1:=index1+1;
end;
index:=index+1;
end;
end;
end.