count

Array-specialization of count with default predicate.

Examples

assert("".count("") == -1); // -1 instead of `assert` that `std.algorithm.count` does
assert("".count("_") == 0);
assert("".count(" ") == 0);
assert(" ".count(" ") == 1);
assert("abc_abc".count("a") == 2);
assert("abc_abc".count("abc") == 2);
assert("_a_a_".count("_") == 3);
assert("_aaa_".count("a") == 3);
assert("".count('_') == 0);
assert("abc_abc".count('a') == 2);
assert("_abc_abc_".count('_') == 3);

Meta