Replace Text

A text replace function for strings.

function ReplaceText(const S,ReplacePiece,ReplaceWith: String):String;
Var
Position: Integer;
TempStr: String;
begin
Position := Pos(ReplacePiece,S);
if Position > 0 then Begin
TempStr := S;
Delete(TempStr,1,Position-1+Length(ReplacePiece));
Result :=
Copy(S,1,Position-1)+ReplaceWith+ReplaceText(TempStr,ReplacePiece,ReplaceWith)

End else Result := S;
end;

Incoming search terms:

  • delphi replace
  • replacetext delphi
  • delphi replace text
  • delphi replacetext
  • delphi text replace
  • delphi string replace
  • replace txt delphi
  • replace word delphi
  • replacetext delphi sample
  • replasetext delphi
This entry was posted in Strings. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Please copy the string zHuWyq to the field below: