indexOf

Undocumented in source. Be warned that the author may not have intended to support it.
  1. size_t indexOf(HaystackT haystack, NeedleT needle)
    @nogc nothrow
    indexOf
    (
    alias Comparator
    HaystackT
    NeedleT
    )
    (
    const auto ref HaystackT haystack
    ,
    const auto ref NeedleT needle
    )
    if (
    canForeachOrProvidesRange!HaystackT
    )
  2. size_t indexOf(HaystackT haystack, NeedleT needle)

Examples

import libd.datastructures.string, libd.datastructures.array;

Array!char arr;
arr.put("0123456789");

assert("0123456789".indexOf('0') == 0);
assert(String("0123456789").indexOf('9') == 9);
assert(arr.indexOf('4') == 4);

assert("The quick brown fox jumped over the lazy dog.".indexOf('d') == 25);
assert("The quick brown fox jumped over the lazy dog.".indexOf('z') == 38);

Meta