function ReplaceInvariant(const OldPattern, NewPattern: string; const ReplaceFlags: TReplaceFlags): Substring; overload;
Replaces OldPattern by NewPattern by UTF-16 code unit: the first occurrence, or every occurrence with rfReplaceAll; rfIgnoreCase ignores case by the operating system's uppercase table, the same under every locale.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | OldPattern | string | |
| 2 | NewPattern | string | |
| 3 | ReplaceFlags | TReplaceFlags |
Returns: Substring - The new value.
Remarks:
Every text kind for both patterns. Note: This routine is 3.7 to 17 times slower than ReplaceAscii due to the operating system's case table. Use ReplaceAscii, if A to Z is enough.
Examples
Accented letters in either case.
uses Substr, System.SysUtils;
procedure Example;
begin
Assert(Substring('AB'#$C9).ReplaceInvariant('b'#$E9, 'x', [rfIgnoreCase]) = 'Ax');
end;