function ReplaceAscii(const OldPattern, NewPattern: string; const ReplaceFlags: TReplaceFlags): Substring; overload;
Replace's rules, with rfIgnoreCase ignoring ASCII case only: A to Z and a to z match each other, every other character, non-ASCII ones included, matches only itself.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | OldPattern | string | |
| 2 | NewPattern | string | |
| 3 | ReplaceFlags | TReplaceFlags |
Returns: Substring - The new value.
Remarks:
Note: This routine handles only ANSI/ASCII case char mapping and does not handle locale specific char handling, but it is 6.4 to 53 times faster than its ReplaceLinguistic alternative.
Examples
The first occurrence and every occurrence, ignoring ASCII case.
uses Substr, System.SysUtils;
procedure Example;
begin
Assert(Substring('aXbx').ReplaceAscii('x', '_', [rfIgnoreCase]) = 'a_bx');
Assert(Substring('aXbx').ReplaceAscii('x', '_', [rfReplaceAll, rfIgnoreCase]) = 'a_b_');
end;