pub fn Count(s: &[byte], sep: impl AsRef<[byte]>) -> intExpand description
Count counts the number of non-overlapping instances of sep in s. If sep is an empty slice, Count returns 1 + the number of UTF-8-encoded code points in s.
zh-cn
返回s字节切片中有几个不重复的sep子切片。§Example
use gostd_bytes as bytes;
assert_eq!(3, bytes::Count("cheese".as_bytes(), "e".as_bytes()));
assert_eq!(5, bytes::Count("five".as_bytes(), "".as_bytes()));
assert_eq!(4, bytes::Count("台湾人香港人澳门人都是中国人".as_bytes(), "人".as_bytes()));