ESubstringCaseError Exception

Exception→ESubstringError→ESubstringCaseError

type ESubstringCaseError = class(ESubstringError);

A routine that compares by code unit was asked to ignore case: Replace with rfIgnoreCase.

The routines that ignore case carry a suffix naming how: Ascii (A to Z only), Invariant (the operating system's uppercase table) or Linguistic (the locale's rules). Replace compares by code unit and raises this exception for rfIgnoreCase; ReplaceAscii, ReplaceInvariant and ReplaceLinguistic take it.

Examples

The base Replace refuses rfIgnoreCase.

delphi
uses Substr, System.SysUtils;

procedure Example;
var s: Substring;
    Raised: Boolean;
begin
    s := Substring('Hello World');
    Raised := False;
    try
        s.Replace('WORLD', 'Earth', [rfIgnoreCase]);
    except
        on ESubstringCaseError do Raised := True;
    end;
    Assert(Raised);
    Assert(s.ReplaceAscii('WORLD', 'Earth', [rfIgnoreCase]) = 'Hello Earth');
end;