Function TrimPrefix

Source
pub fn TrimPrefix(s: &[byte], prefix: impl AsRef<[byte]>) -> &[byte] 
Expand description

TrimPrefix returns s without the provided leading prefix slices. If s doesn’t start with prefix, s is returned unchanged.

zh-cn 返回去除s可能的前缀prefix的子切片。

§Example

use gostd_bytes as bytes;

assert_eq!("Hello, Rust!xxx".as_bytes(),bytes::TrimPrefix("xxxHello, Rust!xxx".as_bytes(),"xxx".as_bytes()));