TrimRightFunc

Function TrimRightFunc 

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

TrimRightFunc returns a subslice of s by slicing off all trailing 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!("123456Hello, Rust".as_bytes(),bytes::TrimRightFunc("123456Hello, Rust654321".as_bytes(), f));