Sign in Join
FPDoc Onlineexperiment

StringReplace function

In unit StrUtils

Optimized search-and-replace algorithm.

Declaration

pascal
function StringReplace(const S: string; const OldPattern: string; 
 const NewPattern: string; Flags: TReplaceFlags; 
 out aCount: Integer; 
 Algorithm: TStringReplaceAlgorithm=sraDefault)
: string; overload

Description

StringReplace replaces one or all occurrences of OldPattern with NewPattern in the string S. The behaviour is controlled by Flags and the search mechanism may be optimized using Algorithm. A list of possible algorithms is specified in TStringReplaceAlgorithm.

For ansistrings, this is an optimized version of the SysUtils.StringReplace algorithm. For widestrings or unicodestrings, the algorithm parameter is ignored and the default mechanism in sysutils is always used.

Errors

None.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.