]> Cypherpunks repositories - gostls13.git/commitdiff
strings,bytes,regexp: use lists in Split* docstrings
authorKir Kolyshkin <kolyshkin@gmail.com>
Thu, 11 Jul 2024 01:46:37 +0000 (18:46 -0700)
committerGopher Robot <gobot@golang.org>
Tue, 16 Jul 2024 18:17:26 +0000 (18:17 +0000)
This looks better than the default of using a code block.
While at it, fix punctuation.

Change-Id: I86abca4da1e9999b7e9043e615ad0988d35a5a46
Reviewed-on: https://go-review.googlesource.com/c/go/+/597656
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

src/bytes/bytes.go
src/regexp/regexp.go
src/strings/strings.go

index 2a07d2084e8efb0470005b5dc18542aa6cb7c89c..a90390b96ea84abc2221eb9107dd35366ec3ad77 100644 (file)
@@ -355,10 +355,9 @@ func genSplit(s, sep []byte, sepSave, n int) [][]byte {
 // the subslices between those separators.
 // If sep is empty, SplitN splits after each UTF-8 sequence.
 // The count determines the number of subslices to return:
-//
-//     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
+//   - 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) }
@@ -367,10 +366,9 @@ func SplitN(s, sep []byte, n int) [][]byte { return genSplit(s, sep, 0, n) }
 // returns a slice of those subslices.
 // If sep is empty, SplitAfterN splits after each UTF-8 sequence.
 // The count determines the number of subslices to return:
-//
-//     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
+//   - 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.
 func SplitAfterN(s, sep []byte, n int) [][]byte {
        return genSplit(s, sep, len(sep), n)
 }
index d1218ad0e872d00211964a7d17e02288d9db90e9..f43954048225dd07855594d56e88f09d0b5a11ff 100644 (file)
@@ -1244,10 +1244,9 @@ func (re *Regexp) FindAllStringSubmatchIndex(s string, n int) [][]int {
 //     // s: ["", "b", "b", "c", "cadaaae"]
 //
 // The count determines the number of substrings to return:
-//
-//     n > 0: at most n substrings; the last substring will be the unsplit remainder.
-//     n == 0: the result is nil (zero substrings)
-//     n < 0: all substrings
+//   - n > 0: at most n substrings; the last substring will be the unsplit remainder;
+//   - n == 0: the result is nil (zero substrings);
+//   - n < 0: all substrings.
 func (re *Regexp) Split(s string, n int) []string {
 
        if n == 0 {
index fba303c12a72070d9a409e60abac1d01b7fdcf95..52a715c66b43e22a016a5c89a327963a80613df0 100644 (file)
@@ -267,10 +267,9 @@ func genSplit(s, sep string, sepSave, n int) []string {
 // the substrings between those separators.
 //
 // The count determines the number of substrings to return:
-//
-//     n > 0: at most n substrings; the last substring will be the unsplit remainder.
-//     n == 0: the result is nil (zero substrings)
-//     n < 0: all substrings
+//   - n > 0: at most n substrings; the last substring will be the unsplit remainder;
+//   - n == 0: the result is nil (zero substrings);
+//   - n < 0: all substrings.
 //
 // Edge cases for s and sep (for example, empty strings) are handled
 // as described in the documentation for [Split].
@@ -282,10 +281,9 @@ func SplitN(s, sep string, n int) []string { return genSplit(s, sep, 0, n) }
 // returns a slice of those substrings.
 //
 // The count determines the number of substrings to return:
-//
-//     n > 0: at most n substrings; the last substring will be the unsplit remainder.
-//     n == 0: the result is nil (zero substrings)
-//     n < 0: all substrings
+//   - n > 0: at most n substrings; the last substring will be the unsplit remainder;
+//   - n == 0: the result is nil (zero substrings);
+//   - n < 0: all substrings.
 //
 // Edge cases for s and sep (for example, empty strings) are handled
 // as described in the documentation for SplitAfter.