[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'sysutils' (#rtl)

# TStringHelper.Replace

Replace occurrences of one string with another.

## Declaration

Source position: syshelph.inc line 150

`public function TStringHelper.Replace(`
`OldChar: Char;`
`NewChar: Char`
`):string; overload; function TStringHelper.Replace(`
`OldChar: Char;`
`NewChar: Char;`
`ReplaceFlags: TReplaceFlags`
`):string; overload; function TStringHelper.Replace(`
`const OldValue: string;`
`const NewValue: string`
`):string; overload; function TStringHelper.Replace(`
`const OldValue: string;`
`const NewValue: string;`
`ReplaceFlags: TReplaceFlags`
`):string; overload;`

## Description

Replace will replace occurrences of OldChar with NewChar or OldValue with NewValue.

If rfReplaceAll is in the ReplaceFlags, then all occurrences will be replaced, otherwise only the first occurrence is replaced.

If rfCaseInsensitive is in the ReplaceFlags, then the search for OldChar or OldValue is performed ignoring case.

## See also

StringReplace |  | Replace occurrences of one substring with another in a string.
TReplaceFlags |  | Flags for StringReplace function

Documentation generated on: May 14 2021