ما هى طريقة حذف جزء من txt
#5
هكذا
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; 
سبحان الله وبحمده سبحان الله العظيم
الرد


الردود في هذا الموضوع
RE: ما هى طريقة حذف جزء من txt - بواسطة Agmcz - 14-01-2016, 02:15 PM
RE: ما هى طريقة حذف جزء من txt - بواسطة لؤي - 14-01-2016, 02:19 PM
RE: ما هى طريقة حذف جزء من txt - بواسطة Agmcz - 14-01-2016, 08:05 PM

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم