Unit 'sysutils' Package
[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] [#rtl]

StringReplace

Replace occurrences of one substring with another in a string.

Declaration

Source position: sysstrh.inc line 258

function StringReplace(

  const S: Ansistring;

  const OldPattern: Ansistring;

  const NewPattern: Ansistring;

  Flags: TReplaceFlags;

  out aCount: Integer

):ansistring;

function StringReplace(

  const S: Ansistring;

  const OldPattern: Ansistring;

  const NewPattern: Ansistring;

  Flags: TReplaceFlags

):ansistring;

function StringReplace(

  const S: UnicodeString;

  const OldPattern: UnicodeString;

  const NewPattern: UnicodeString;

  Flags: TReplaceFlags

):UnicodeString;

function StringReplace(

  const S: UnicodeString;

  const OldPattern: UnicodeString;

  const NewPattern: UnicodeString;

  Flags: TReplaceFlags;

  out aCount: Integer

):UnicodeString;

function StringReplace(

  const S: UnicodeString;

  OldPattern: WideChar;

  NewPattern: WideChar;

  Flags: TReplaceFlags

):UnicodeString;

Description

StringReplace searches the string S for occurrences of the string OldPattern and, if it is found, replaces it with NewPattern. It returns the resulting string. The behaviour of StringReplace can be tuned with Flags, which is of type TReplaceFlags. Standard behaviour is to replace only the first occurrence of OldPattern, and to search case sensitively.

Errors

None.

See also

TReplaceFlags

  

Flags for StringReplace function.

WideStringReplace

  

Replace occurrences of one substring with another in a widestring.


Documentation generated on: Dec 22 2024