bytecount

Function count

Source
pub fn count(haystack: &[u8], needle: u8) -> usize
Expand description

Count occurrences of a byte in a slice of bytes, fast

ยงExamples

let s = b"This is a Text with spaces";
let number_of_spaces = bytecount::count(s, b' ');
assert_eq!(number_of_spaces, 5);