Substring.LastDelimiter Method

Overload List

#SignatureDescription
1function LastDelimiter(const Delims: TSysCharSet): Integer; overload;
2function LastDelimiter(const Delims: string): Integer; overload;The 0-based index of the last character that is one of Delims, -1 when there is none.

Overload 1: function LastDelimiter(const Delims: TSysCharSet): Integer; overload;

#NameTypeDescription
1DelimsTSysCharSet

Returns: Integer

Overload 2: function LastDelimiter(const Delims: string): Integer; overload;

The 0-based index of the last character that is one of Delims, -1 when there is none.

#NameTypeDescription
1Delimsstring

Returns: Integer

Remarks:

Delims takes every text kind, or a TSysCharSet.

Examples

The extension's dot and the last path separator.

uses Substr;

procedure Example;
var s: Substring;
begin
    s := Substring('C:\dir\file.txt');
    Assert(s.LastDelimiter('\.') = 11);
    Assert(s.LastDelimiter(['\']) = 6);
end;