diff options
| author | Ian Lance Taylor <iant@golang.org> | 2022-02-03 12:13:00 -0800 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2022-02-08 22:25:54 +0000 |
| commit | 540632841e678573885e296db0cb73b15f48f96c (patch) | |
| tree | 36576db53a342a2fbfd6cf2f55739ffe205ab5e1 /src/bytes/bytes.go | |
| parent | 3e514a0103a7e335c70104435555229f51e4d9ae (diff) | |
| download | go-540632841e678573885e296db0cb73b15f48f96c.tar.xz | |
bytes, strings: mention Cut in docs for Split and SplitN
For #46336
Change-Id: Idc23302085e14e24d571f5995d6d33ca964a0021
Reviewed-on: https://go-review.googlesource.com/c/go/+/382954
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/bytes/bytes.go')
| -rw-r--r-- | src/bytes/bytes.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/bytes/bytes.go b/src/bytes/bytes.go index 6fdaa49c73..41323ad549 100644 --- a/src/bytes/bytes.go +++ b/src/bytes/bytes.go @@ -372,6 +372,8 @@ func genSplit(s, sep []byte, sepSave, n int) [][]byte { // n > 0: at most n subslices; the last subslice will be the unsplit remainder. // n == 0: the result is nil (zero subslices) // n < 0: all subslices +// +// To split around the first instance of a separator, see Cut. func SplitN(s, sep []byte, n int) [][]byte { return genSplit(s, sep, 0, n) } // SplitAfterN slices s into subslices after each instance of sep and @@ -389,6 +391,8 @@ func SplitAfterN(s, sep []byte, n int) [][]byte { // the subslices between those separators. // If sep is empty, Split splits after each UTF-8 sequence. // It is equivalent to SplitN with a count of -1. +// +// To split around the first instance of a separator, see Cut. func Split(s, sep []byte) [][]byte { return genSplit(s, sep, 0, -1) } // SplitAfter slices s into all subslices after each instance of sep and |
