endsWith

fnuint endsWith(alias pred = "a == b", Range, Needles...)(Range doesThisEnd, Needles withOneOfThese) if (isBidirectionalRange!Range && Needles.length > 1 && allSatisfy!(canTestStartsWith!(pred, Range), Needles))

Checks if the given range ends with (one of) the given needle(s). The reciprocal of startsWith.

Parameters

predThe predicate to use for comparing elements between the range and the needle(s).
doesThisEndThe bidirectional range to check.
withOneOfTheseThe needles to check against, which may be single elements, or bidirectional ranges of elements.
withThisThe single element to check.

Returns

0 if the needle(s) do not occur at the end of the given range;

otherwise the position of the matching needle, that is, 1 if the range ends with withOneOfThese[0], 2 if it ends with withOneOfThese[1], and so on.

In the case when no needle parameters are given, return true iff back of doesThisStart fulfils predicate pred.

fnbool endsWith(alias pred = "a == b", R1, R2)(R1 doesThisEnd, R2 withThis) if (isBidirectionalRange!R1 && isBidirectionalRange!R2 && is(typeof(binaryFun!pred(doesThisEnd.back, withThis.back)) : bool))

Ditto

fnbool endsWith(alias pred = "a == b", R, E)(R doesThisEnd, E withThis) if (isBidirectionalRange!R && is(typeof(binaryFun!pred(doesThisEnd.back, withThis)) : bool))

Ditto

fnbool endsWith(alias pred, R)(R doesThisEnd) if (isInputRange!R && ifTestable!(typeof(doesThisEnd.front), unaryFun!pred))

Ditto