Logo

Programming-Idioms

History of Idiom 63 > diff from v20 to v21

Edit summary for version 21 by :

Version 20

2015-11-01, 23:12:45

Version 21

2015-11-01, 23:16:54

Idiom #63 Replace fragment of a string

Assign to x2 the value of string x with all occurrences of y replaced by z.
Assume occurrences of y are not overlapping.

Idiom #63 Replace fragment of a string

Assign to x2 the value of string x with all occurrences of y replaced by z.
Assume occurrences of y are not overlapping.

Imports
SysUtils
Imports
uses
  SysUtils;
Code
var
  _x, _y, _z, _x2: String;
begin
  _x2 := StringReplace(_x, _y, _z, [rfReplaceAll]);
end;
Code
x2 := StringReplace(x, y, z, [rfReplaceAll]);