MCPcopy Create free account
hub / github.com/ashvardanian/StringZilla / find_byte_not_from

Function find_byte_not_from

rust/stringzilla.rs:1506–1512  ·  view source on GitHub ↗

Finds the index of the first character in `haystack` that is not present in `needles`. This function is useful for skipping over a known set of characters and finding the first character that does not belong to that set. # Arguments `haystack`: The byte slice to search. `needles`: The set of bytes that should not be matched within the haystack. # Returns An `Option ` representing the ind

(haystack: H, needles: N)

Source from the content-addressed store, hash-verified

1504/// An `Option<usize>` representing the index of the first occurrence of any byte not in
1505/// `needles` within `haystack`, if found, otherwise `None`.
1506pub fn find_byte_not_from<H, N>(haystack: H, needles: N) -> Option<usize>
1507where
1508 H: AsRef<[u8]>,
1509 N: AsRef<[u8]>,
1510{
1511 find_byteset(haystack, Byteset::from(needles).inverted())
1512}
1513
1514/// Finds the index of the last character in `haystack` that is not present in `needles`.
1515/// Useful for text processing tasks such as trimming trailing characters that belong to

Callers 2

findMethod · 0.85
sz_find_byte_not_fromMethod · 0.85

Calls 2

find_bytesetFunction · 0.85
invertedMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…