Fields

Function Fields 

Source
pub fn Fields(s: &[byte]) -> Vec<&[byte]>
Expand description

Fields interprets s as a sequence of UTF-8-encoded code points. It splits the slice s around each instance of one or more consecutive white space characters, as defined by unicode.IsSpace, returning a slice of subslices of s or an empty slice if s contains only white space.

zh-cn 字段将s解释为UTF-8编码的代码点序列。它围绕由unicode定义的一个或多个连续空白字符的每个实例分割成子切片。

§Example

use gostd_bytes as bytes;
 assert_eq!(vec!["foo".as_bytes(),"bar".as_bytes(),"baz".as_bytes()],bytes::Fields("  foo bar  baz   ".as_bytes()));
 assert_eq!(
    vec!["aaa".as_bytes(), "bbb".as_bytes(), "cccc".as_bytes(), "ddd".as_bytes()],
    bytes::Fields("  \taaa bbb\t  cccc\r ddd  \r".as_bytes()));