14-01-2016, 08:05 PM
هكذا
PHP كود :
function Copy_Comment(const Text_File, Start, Stop: string): string;
var
I, P1, P2: Cardinal;
SL, SL2: TStringList;
begin
Result := '';
if Text_File = '' then
Exit;
SL := TStringList.Create;
SL2 := TStringList.Create;
try
if FileExists(Text_File) then
SL.LoadFromFile(Text_File)
else
SL.Text := Text_File;
for I := 0 to SL.Count - 1 do
begin
P1 := Pos(Start, SL[I]);
P2 := Pos(Stop, Copy(SL[I], P1+1, Length(SL[I])));
if (P1 > 0) and (P2 > 0) then
SL2.Add(Copy(SL[I], P1+1, P2-1));
end;
Result := SL2.Text;
finally
SL.Free;
SL2.Free;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
//Memo2.Text := Copy_Des('C:\MyFile.txt', '"', '"'); load from file
// or
Memo2.Text := Copy_Des(Memo1.Text, '"', '"'); //load from string
end;
سبحان الله وبحمده سبحان الله العظيم

