pub fn TrimSpace(s: &[byte]) -> &[byte] ⓘExpand description
TrimSpace returns a subslice of s by slicing off all leading and trailing white space, as defined by Unicode.
zh-cn
返回将s前后端所有空白(is_whitespace()指定)都去掉的切片。§Example
use gostd_bytes as bytes;
assert_eq!("Hello, Rust!".as_bytes(),bytes::TrimSpace(" Hello, Rust! ".as_bytes()));
assert_eq!("Hello, Rust!".as_bytes(),bytes::TrimSpace("\nHello, Rust! \t ".as_bytes()));
assert_eq!("Hello, Rust!".as_bytes(),bytes::TrimSpace("\n\t Hello, Rust! \t\r ".as_bytes()));