遇到 的小问题:想把所有PAS文件中包含‘c_AppEdition’内容的文件筛选出来
用DELPHI XE10.3处理代码如下,当作笔记本
unit Unit12;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs
,
IOUtils,
System.Types,
Vcl.StdCtrls;
type
TForm12 = class(TForm)
Memo1: TMemo;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form12: TForm12;
implementation
{$R *.dfm}
const path = 'I:\0mrp\制衣MRP管理系统\制衣MRP管理系统 无错版\Clothing\Client\Public';
procedure TForm12.FormCreate(Sender: TObject);
var
dfs: TStringDynArray;
s, str: string;
t: TextFile;
begin
dfs:= TDirectory.GetFiles(path) ;
Memo1.Clear;
for str in dfs do
begin
if extractfileext(str)='.pas' then
begin
AssignFile(t, str);
Reset(t);
while not eof(t) do
begin
readln(t,s);//读取一行保存到字符串s中
if POS('c_AppEdition',S)>0 then //查找c_AppEdition
Memo1.Lines.Add(STR);//在Memo1中显示
end;
end;
end;
end;
end.