Documentation
Back to website >

ReplaceAllStr (Pascalscript)

Description

ReplaceAllStr converts all occurrences from S1 to S into the string specified by S2.

Syntax

function ReplaceAllStr(const S,S1,S2: string): string;

Arguments

ReplaceAllStr exchanges all occurrences of the string specified in S1 that occur in S in the string specified by S2.

Example

var
  S1: String;
  S2: String;
begin
  S1:='Tausche &Floskel1 auch aus, wenn &Floskel1 '+
       'mehrfach vorkommt';
  S2:=ReplaceAllStr(S1,'&Floskel1','Hallo Welt');
  ShowMessage(S2);
end;

Rules to understand the script can be found here.

The text 'Tausche &Floskel1 auch aus, wenn &Floskel1 mehrfach vorkommt' is assigned to the string variable S1. The function ReplaceAllStr replaces all occurrences of "&Floskel1" with "Hallo Welt". The result is assigned to the string variable S2.

ShowMessage shows: Tausche Hallo Welt auch aus, wenn Hallo Welt mehrfach vorkommt