pub fn memmem(haystack: &[u8], needle: &[u8]) -> Option<usize>
Expand description
This mimics libc::memmem()
, same as (haystack as &str).find(needle as &str)
or haystack.windows(needle.len()).position(|window| window == needle)
.
This memmem()
function is implemented using stochastic naive algorithm.
ref.) The optimized naive string-search algorithm