Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
procedure TForm1.ReplaceDialog1Replace(Sender: TObject);
var
SelPos: Integer;
begin
with TReplaceDialog(Sender) do
begin
{ Perform a global case-sensitive search for FindText in Memo1 }
SelPos := Pos(FindText, RichEdit1.Lines.Text);
if SelPos > 0 then
begin
RichEdit1.SelStart := SelPos - 1;
RichEdit1.SelLength := Length(FindText);
{ Replace selected text with ReplaceText }
RichEdit1.SelText := ReplaceText;
end
else
MessageDlg(Concat('Could not find "', FindText, '" in RichEdit1.'), mtError, [mbOk], 0);
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
ReplaceDialog1.Execute;
end;
slFile := TStringList.create;
slFile.LoadFromFile('C:\MyFile.txt');
for i := 0 to (slFile.count - 1) do
slFile[i] := StringReplace(slFile[i], '1', '0', [rfReplaceAll]);
slFile.SaveToFile('C:\MyFile.txt');
slFile := TStringList.Create;
try
slFile.LoadFromFile ( 'c:\myfile.txt' );
slFile.Text := StringReplace ( slFile.Text, '1', '0', [rfReplaceAll] );
slFile.SaveToFile ( 'c:\myfile.txt' );
finally
slFile.Free;
end;