lastIndexOf

Array-specialization of lastIndexOf with default predicate.

  1. ptrdiff_t lastIndexOf(inout(T)[] haystack, const(T)[] needle)
  2. ptrdiff_t lastIndexOf(inout(T)[] haystack, T needle)
    ptrdiff_t
    lastIndexOf
    (
    T
    )
    (
    scope inout(T)[] haystack
    ,
    scope const T needle
    )

Examples

assert("_abc_abc_".lastIndexOf("abc") == 5);
assert("__abc_".lastIndexOf("abc") == 2);
assert("a".lastIndexOf("a") == 0);
assert("aa".lastIndexOf("a") == 1);
assert("abc".lastIndexOf("abc") == 0);
assert("_".lastIndexOf("a") == -1);
assert("_".lastIndexOf("__") == -1);
assert("__".lastIndexOf("a") == -1);
assert("_".lastIndexOf('a') == -1);
assert("a".lastIndexOf('a') == 0);
assert("_a".lastIndexOf('a') == 1);
assert("__a".lastIndexOf('a') == 2);
assert("a__a".lastIndexOf('a') == 3);

Meta