Skip to main content

strchr

Function strchr 

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

Return the byte index of the first occurrence of needle in haystack, or None if absent.

ยงExamples

use dynomite::util::dyn_string::strchr;
assert_eq!(strchr(b"abcde", b'c'), Some(2));
assert_eq!(strchr(b"abcde", b'z'), None);