Function TrimLeftFunc

Source
pub fn TrimLeftFunc(s: &[byte], f: fn(rune) -> bool) -> &[byte] 
Expand description

TrimLeftFunc treats s as UTF-8-encoded bytes and returns a subslice of s by slicing off all leading UTF-8-encoded code points c that satisfy f(c).

zh-cn 返回将s前端所有满足f的unicode码值都去掉的子切片。

§Example

use gostd_bytes as bytes;

let f = |x| x >= '1' as u32 && x <= '9' as u32;
assert_eq!("Hello, Rust654321".as_bytes(),bytes::TrimLeftFunc("123456Hello, Rust654321".as_bytes(), f));