ReplaceText
ReplaceText replaces all instances of the string specified by AFromText in the source string AText, with the string AToText, and returns this amended value as the resulting string.
The function is not case sensitive.
For a case sensitive replacement, use the ReplaceStr routine. please review ReplaceStr for more information.
Declaration: Function ReplaceText(const AText, AFromText, AToText : string) : string;
Examples are detailed below - including an example showing how this function handles case.
procedure
ScriptEvent(
var
Value:Variant);
var
Str1, Str2, Str3, Str4 :
string
;
begin
Str1 :=
'Mary had a little lamb.'
Str2 :=
'little'
Str3 :=
'massive'
Str4 := ReplaceText(Str1, Str2, Str3);
LogInfo(
'The text has gone from '
''
+Str1+
''
' to '
''
+Str4+
''
''
);
Str1 :=
'Jack and Jill went up the hill.'
Str2 :=
'HILL'
Str3 :=
'Mountain'
Str4 := ReplaceText(Str1, Str2, Str3);
LogInfo(
'The text has gone from '
''
+Str1+
''
' to '
''
+Str4+
''
''
);
LogInfo(
''
);
end
;
The resulting entries in the log are as follows.

Please also review the StuffString function StuffString.