System.WideStrUtils.WideStringReplace

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function WideStringReplace(const S, OldPattern, NewPattern: Widestring; const Flags: TReplaceFlags): Widestring;

C++

extern DELPHI_PACKAGE System::WideString __fastcall WideStringReplace(const System::WideString S, const System::WideString OldPattern, const System::WideString NewPattern, const System::Sysutils::TReplaceFlags Flags);

Properties

Type Visibility Source Unit Parent
function public
System.WideStrUtils.pas
System.WideStrUtils.hpp
System.WideStrUtils System.WideStrUtils

Description

Replaces occurrences of a substring within a string.

WideStringReplace replaces occurrences of the substring specified by OldPattern with the substring specified by NewPattern in the string S.

Flags is a TReplaceFlags type parameter. If rfIgnoreCase is set, the replacement is case-sensitive; otherwise case is ignored. If rfReplaceAll is on, all occurrences of OldPattern are replaced; if not, only the first occurrence is replaced.

Note: This function is designed for WideString variables. To work with AnsiString variables, use the System.AnsiStrings.StringReplace function. To work with UnicodeString variables, use the System.SysUtils.StringReplace function.

Note: Recursive replacement of substrings is not supported. This means that if the substitution of OldPattern results in a new match for NewPattern, that match is not replaced.

To replace all occurrences of the substring within the string, you may also use the WideReplaceStr function to do a case-sensitive search, or WideReplaceText to do a case-insensitive search.

See Also