Substring.IndexOfEither Method

function IndexOfEither(const C1, C2: Char): Integer;

The 0-based index of the first character that is C1 or C2; -1 when there is none.

#NameTypeDescription
1C1Char
2C2Char

Returns: Integer

Examples

The end of the first line, whichever line break it has.

uses Substr;

procedure Example;
var s: Substring;
begin
    s := Substring('first'#13#10'second');
    Assert(s.IndexOfEither(#13, #10) = 5);
    s := Substring('first'#10'second');
    Assert(s.IndexOfEither(#13, #10) = 5);
end;
See Also: Substring.IndexOfAny, Substring.IndexOfAny