RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
SysUtils.StringReplace Function

Returns a string with occurrences of one substring replaced by another substring.

Pascal
function StringReplace(const S: string; const OldPattern: string; const NewPattern: string; Flags: TReplaceFlags): string;
C++
AnsiString StringReplace(const AnsiString S, const AnsiString OldPattern, const AnsiString NewPattern, TReplaceFlags Flags);

SysUtils

StringReplace replaces occurrences of the substring specified by OldPattern with the substring specified by NewPattern. StringReplace assumes that the source string may contain Multibyte characters. 

S is the source string, whose substrings are changed. 

OldPattern is the substring to locate and replace with NewPattern. 

NewPattern is the substring to substitute for occurrences of OldPattern. 

Flags is a set of flags that govern how StringReplace locates and replaces occurrences of OldPattern. If Flags does not include rfReplaceAll, StringReplace only replaces the first occurrence of OldPattern in S. Otherwise, StringReplace replaces all instances of OldPattern with NewPattern. If the Flags parameter includes rfIgnoreCase, the comparison operation is case insensitive. 

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!