Function stringzilla::sz::find
source · pub fn find<H, N>(haystack: H, needle: N) -> Option<usize>Expand description
Locates the first matching substring within haystack that equals needle.
This function is similar to the memmem() function in LibC, but, unlike strstr(),
it requires the length of both haystack and needle to be known beforehand.
§Arguments
haystack: The byte slice to search.needle: The byte slice to find within the haystack.
§Returns
An Option<usize> representing the starting index of the first occurrence of needle
within haystack if found, otherwise None.