Anasayfa / Delphi / Delphi RichEdit Bul değiştir Search and replace text in a RichEdit

Delphi RichEdit Bul değiştir Search and replace text in a RichEdit

function Search_And_Replace(RichEdit: TRichEdit; SearchText, ReplaceText:
string): boolean;
var
  startpos, position, endpos: integer;
begin
  startpos := 0;
  with RichEdit do
  begin
    endpos := Length(RichEdit.Text);
    Lines.BeginUpdate;
    while FindText(SearchText, startpos, endpos, [stMatchCase])<>-1 do
    begin
      endpos  := Length(RichEdit.Text) - startpos;
      position := FindText(SearchText, startpos, endpos, [stMatchCase]);
      Inc(startpos, Length(SearchText));
      SetFocus;
      SelStart  := position;
      SelLength := Length(SearchText);
      richedit.clearselection;
      SelText := ReplaceText;
    end;
    Lines.EndUpdate;
  end;
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
Search_And_Replace(Richedit1,'Eski Yazı','Yeni Yazı');
end;

Hakkında ibrahim

İlgili Makaleler

borlndmm.dll disable delphi

Kod yürütülmesi devam edemiyor çünkü borlndmm.dll bulunamadı. Programı yeniden yüklemek bu sorunu çözebilir. borlndmm.dll gerekliliğini …

Bir cevap yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir