pub fn Index(s: impl AsRef<[byte]>, sep: impl AsRef<[byte]>) -> intExpand description
Index returns the index of the first instance of sep in s, or -1 if sep is not present in s.
zh-cn
子切片sep在s中第一次出现的位置,不存在则返回-1。§Example
use gostd_bytes as bytes;
assert_eq!(4,bytes::Index("rust社区 rust社区acean".to_string(),"社区".to_string()));
assert_eq!(4,bytes::Index("rust社区 rust社区acean".as_bytes(),"社区".as_bytes()));
assert_eq!(4,bytes::Index("chkcken", "ken"));
assert_eq!(-1,bytes::Index("chicken", "dmr"));