[][src]Function bytecount::count

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

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);