ESubstringError Exception

Exception→ESubstringError

type ESubstringError = class(Exception);

The base class of the exceptions Substring raises.

Examples

Catching every Substring error.

delphi
uses Substr, System.SysUtils;

procedure Example;
var Raised: Boolean;
begin
    Raised := False;
    try
        Assert(Substring('abc').Mid(2, 5).IsEmpty);
    except
        on ESubstringError do Raised := True;
    end;
    Assert(Raised);
end;