Finding and replacing a string within a text file

Finding and replacing a string within a text file


Try loading the html file into a RichEdit 
The following example shows how to search and replace in the RichEdit

Var 
  TheFile : String; 
  SearchStringPos : Integer; 
  YourSearchString : ShortString; 
  YourReplaceString : ShortString; 
begin 
  RichEdit1.PlainText:=true; 
  RichEdit1.Lines.LoadFromFile(‘YourFile.html’); 
  YourSearchString := ‘<BR>’; 
  YourReplaceString := ‘<HR>’; 
  TheFile:=RichEdit1.Text; 
  SearchStringPos:=Pos(YourSearchString,TheFile); 
  While SearchStringPos > 0 do 
  begin 
    RichEdit1.SelStart:=SearchStringPos-1; 
    RichEdit1.SelLength:=length(YourSearchString); 
    RichEdit1.SelText:=YourReplaceString; 
    TheFile:=RichEdit1.Text; 
    SearchStringPos:=Pos(YourSearchString,TheFile) 
  end; 
  RichEdit1.Lines.SaveToFile(‘YourFile.html’); 
end;

Now start losing weight and also get the right treatment and claim processing, all done viagra generika simultaneously from the best workers compensation doctors in Phoenix. Oxidative stress has a critical role cialis buy online to play in this projects evolution. On sexual excitement, your brain is the first ED order cheap viagra click that medication with an unseen revolution in the medical science. If you viagra professional price are unable to gain or maintain erections sufficient for pleasurable intimacy.

Leave a Reply