Skip to content
Snippets Groups Projects
Commit 35c0ea22 authored by Cherry Mui's avatar Cherry Mui
Browse files

[release-branch.go1.24] bytes: use "subslice" instead of "substring" in doc comments

The bytes package iterators return subslices, not substrings.

Updates #61901.

Change-Id: Ida91d3e33a0f178edfe9a267861adf4f13f9a965
Reviewed-on: https://go-review.googlesource.com/c/go/+/647875


Reviewed-by: default avatarIan Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
(cherry picked from commit ff27d270)
Reviewed-on: https://go-review.googlesource.com/c/go/+/648095


Reviewed-by: default avatarDmitri Shuralyov <dmitshur@google.com>
Reviewed-by: default avatarDmitri Shuralyov <dmitshur@golang.org>
TryBot-Bypass: Cherry Mui <cherryyz@google.com>
parent 6d399e9d
No related branches found
No related tags found
No related merge requests found
...@@ -67,26 +67,26 @@ func splitSeq(s, sep []byte, sepSave int) iter.Seq[[]byte] { ...@@ -67,26 +67,26 @@ func splitSeq(s, sep []byte, sepSave int) iter.Seq[[]byte] {
} }
} }
// SplitSeq returns an iterator over all substrings of s separated by sep. // SplitSeq returns an iterator over all subslices of s separated by sep.
// The iterator yields the same strings that would be returned by [Split](s, sep), // The iterator yields the same subslices that would be returned by [Split](s, sep),
// but without constructing the slice. // but without constructing a new slice containing the subslices.
// It returns a single-use iterator. // It returns a single-use iterator.
func SplitSeq(s, sep []byte) iter.Seq[[]byte] { func SplitSeq(s, sep []byte) iter.Seq[[]byte] {
return splitSeq(s, sep, 0) return splitSeq(s, sep, 0)
} }
// SplitAfterSeq returns an iterator over substrings of s split after each instance of sep. // SplitAfterSeq returns an iterator over subslices of s split after each instance of sep.
// The iterator yields the same strings that would be returned by [SplitAfter](s, sep), // The iterator yields the same subslices that would be returned by [SplitAfter](s, sep),
// but without constructing the slice. // but without constructing a new slice containing the subslices.
// It returns a single-use iterator. // It returns a single-use iterator.
func SplitAfterSeq(s, sep []byte) iter.Seq[[]byte] { func SplitAfterSeq(s, sep []byte) iter.Seq[[]byte] {
return splitSeq(s, sep, len(sep)) return splitSeq(s, sep, len(sep))
} }
// FieldsSeq returns an iterator over substrings of s split around runs of // FieldsSeq returns an iterator over subslices of s split around runs of
// whitespace characters, as defined by [unicode.IsSpace]. // whitespace characters, as defined by [unicode.IsSpace].
// The iterator yields the same strings that would be returned by [Fields](s), // The iterator yields the same subslices that would be returned by [Fields](s),
// but without constructing the slice. // but without constructing a new slice containing the subslices.
func FieldsSeq(s []byte) iter.Seq[[]byte] { func FieldsSeq(s []byte) iter.Seq[[]byte] {
return func(yield func([]byte) bool) { return func(yield func([]byte) bool) {
start := -1 start := -1
...@@ -116,10 +116,10 @@ func FieldsSeq(s []byte) iter.Seq[[]byte] { ...@@ -116,10 +116,10 @@ func FieldsSeq(s []byte) iter.Seq[[]byte] {
} }
} }
// FieldsFuncSeq returns an iterator over substrings of s split around runs of // FieldsFuncSeq returns an iterator over subslices of s split around runs of
// Unicode code points satisfying f(c). // Unicode code points satisfying f(c).
// The iterator yields the same strings that would be returned by [FieldsFunc](s), // The iterator yields the same subslices that would be returned by [FieldsFunc](s),
// but without constructing the slice. // but without constructing a new slice containing the subslices.
func FieldsFuncSeq(s []byte, f func(rune) bool) iter.Seq[[]byte] { func FieldsFuncSeq(s []byte, f func(rune) bool) iter.Seq[[]byte] {
return func(yield func([]byte) bool) { return func(yield func([]byte) bool) {
start := -1 start := -1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment