pub fn IndexByte(s: impl AsRef<[byte]>, c: byte) -> intExpand description
IndexByte returns the index of the first instance of c in b, or -1 if c is not present in b.
zh-cn
字符c在s切片中第一次出现的位置,不存在则返回-1。§Example
use gostd_bytes as bytes;
assert_eq!(0,bytes::IndexByte("rustlang",b'r'));
assert_eq!(3,bytes::IndexByte("gophers",b'h'));
assert_eq!(0,bytes::IndexByte("rustlang".as_bytes(),b'r'));
assert_eq!(3,bytes::IndexByte("gophers".as_bytes(),b'h'));
assert_eq!(-1,bytes::IndexByte("gophers".to_string(),b'x'));