unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,PerlRegEx;
type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
Edit1: TEdit;
Edit2: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function MMFileToString(const AFilename: string): string;
var
hFile: THandle;
hFileMap: THandle;
hiSize: DWORD;
loSize: DWORD;
text: string;
view: pointer;
begin
Result := '';
if AFilename = '' then
Exit;
if not FileExists(AFilename) then
Exit;
{Open the file}
hFile := CreateFile(PChar(AFilename), GENERIC_READ, FILE_SHARE_READ, nil,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if hFile <> INVALID_HANDLE_VALUE then
begin
delphi 快速读取文件 然后用TPerlRegEx类提取需要内容
最新推荐文章于 2021-09-08 15:09:05 发布
本文介绍了如何在Delphi中快速读取文件内容,并利用TPerlRegEx类进行字符串匹配和提取所需信息,适用于需要处理大量文本数据的场景。
摘要由CSDN通过智能技术生成