- Sort Score
- Result 10 results
- Languages All
Results 1 - 3 of 3 for FieldsSeq (0.03 sec)
-
src/bytes/example_test.go
text := []byte("The quick brown fox") fmt.Println("Split byte slice into fields:") for word := range bytes.FieldsSeq(text) { fmt.Printf("%q\n", word) } textWithSpaces := []byte(" lots of spaces ") fmt.Println("\nSplit byte slice with multiple spaces:") for word := range bytes.FieldsSeq(textWithSpaces) { fmt.Printf("%q\n", word) } // Output: // Split byte slice into fields: // "The"
Registered: Tue Sep 09 11:13:09 UTC 2025 - Last Modified: Mon May 12 16:07:54 UTC 2025 - 16.5K bytes - Viewed (0) -
src/bytes/iter.go
return splitSeq(s, sep, len(sep)) } // FieldsSeq returns an iterator over subslices of s split around runs of // whitespace characters, as defined by [unicode.IsSpace]. // The iterator yields the same subslices that would be returned by [Fields](s), // but without constructing a new slice containing the subslices. func FieldsSeq(s []byte) iter.Seq[[]byte] { return func(yield func([]byte) bool) { start := -1
Registered: Tue Sep 09 11:13:09 UTC 2025 - Last Modified: Wed Sep 03 14:04:47 UTC 2025 - 3.6K bytes - Viewed (0) -
src/bytes/bytes_test.go
if !slices.Equal(result, tt.a) { t.Errorf("Fields(%q) = %v; want %v", tt.s, a, tt.a) continue } result2 := sliceOfString(collect(t, FieldsSeq([]byte(tt.s)))) if !slices.Equal(result2, tt.a) { t.Errorf(`collect(FieldsSeq(%q)) = %v; want %v`, tt.s, result2, tt.a) } if string(b) != tt.s { t.Errorf("slice changed to %s; want %s", string(b), tt.s) } if len(tt.a) > 0 {
Registered: Tue Sep 09 11:13:09 UTC 2025 - Last Modified: Mon Jul 28 18:13:58 UTC 2025 - 62.9K bytes - Viewed (0)