Function lastIndexOf

Finds the first element in a range that equals some value

auto auto lastIndexOf(Range, T) (
  Range range,
  T value,
  size_t fromIndex = 0
)
if (from.std.range.isBidirectionalRange!Range);

Parameters

NameDescription
range an input range
value value to search for
fromIndex which index from the end to start searching from

Returns

An optional!T

Since

0.0.1

Example

import ddash.utils: some, none;
assert([1, 2, 1, 2].indexOf(2) == some(1));
assert([1, 2, 1, 2].indexOf(2, 2) == some(3));
assert([1, 2, 1, 2].indexOf(3) == none);