aboutsummaryrefslogtreecommitdiff
path: root/src/strings/strings.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2022-02-03 12:13:00 -0800
committerIan Lance Taylor <iant@golang.org>2022-02-08 22:25:54 +0000
commit540632841e678573885e296db0cb73b15f48f96c (patch)
tree36576db53a342a2fbfd6cf2f55739ffe205ab5e1 /src/strings/strings.go
parent3e514a0103a7e335c70104435555229f51e4d9ae (diff)
downloadgo-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/strings/strings.go')
-rw-r--r--src/strings/strings.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/strings/strings.go b/src/strings/strings.go
index c5a29e95f6..5793d9e26f 100644
--- a/src/strings/strings.go
+++ b/src/strings/strings.go
@@ -270,6 +270,8 @@ func genSplit(s, sep string, sepSave, n int) []string {
//
// Edge cases for s and sep (for example, empty strings) are handled
// as described in the documentation for Split.
+//
+// To split around the first instance of a separator, see Cut.
func SplitN(s, sep string, n int) []string { return genSplit(s, sep, 0, n) }
// SplitAfterN slices s into substrings after each instance of sep and
@@ -296,6 +298,8 @@ func SplitAfterN(s, sep string, n int) []string {
// and sep are empty, Split returns an empty slice.
//
// 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 string) []string { return genSplit(s, sep, 0, -1) }
// SplitAfter slices s into all substrings after each instance of sep and