var i1,i,k,j,count:integer;
s:string;
result:real;
begin
j:=0;
count:=0;
for i1:=0 to Form1.ListBox1.Items.Count-1 do
begin
Form1.RichEdit1.Clear;
Form1.RichEdit1.Lines.LoadFromFile(Form1.ListBox1.Items.Strings[i1]);
for i:=0 to Form1.RichEdit1.Lines.Count-1 do
begin
s:=Form1.RichEdit1.Lines[i];
if Form1.RichEdit1.Lines.Strings[i]=Memo1.Text then
begin
j:=j+1;
end;
s:=Copy(s,pos(' ',s)+1,Length(s)-Pos(' ',s));
for k:=0 to Length(s)-1 do
begin
if s[k]=Memo2.Text then
begin
count:=count+1;
end;
end;
end;
end; result:=j/count;
RichEdit1.Lines.Add(Memo1.Text+FloattoStr(result));
end;
end.
关于这个我是这样写的,但是运行的时候着色部分出问题,在delphi中用蓝色标注,不知什么问题,请指教