count

Array-specialization of count with default predicate.

Examples

// import std.algorithm.searching : count;
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("_a_a_".count("") == 5);
assert("".count('_') == 0);
assert("abc_abc".count('a') == 2);
assert("_abc_abc_".count('_') == 3);

Meta