]> Cypherpunks repositories - gostls13.git/commitdiff
strings: more cross-references in docstrings
authorKir Kolyshkin <kolyshkin@gmail.com>
Thu, 11 Jul 2024 01:37:00 +0000 (18:37 -0700)
committerGopher Robot <gobot@golang.org>
Thu, 11 Jul 2024 15:01:18 +0000 (15:01 +0000)
This amends CL 534775.

Change-Id: I25a217da51853ec29106998e19e9386d756902fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/597655
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

src/strings/compare.go
src/strings/replace.go
src/strings/strings.go

index b3c01fddc15493c1bf9f09a57dea7c6ec8d65ca5..dcf442471af63f43f118d6c877183b4c283496d6 100644 (file)
@@ -10,7 +10,7 @@ import "internal/bytealg"
 // The result will be 0 if a == b, -1 if a < b, and +1 if a > b.
 //
 // Use Compare when you need to perform a three-way comparison (with
-// slices.SortFunc, for example). It is usually clearer and always faster
+// [slices.SortFunc], for example). It is usually clearer and always faster
 // to use the built-in string comparison operators ==, <, >, and so on.
 func Compare(a, b string) int {
        return bytealg.CompareString(a, b)
index 3b17a55b915d7de1b665dca45378f413325a25cf..ae127288003dbc83f042388ba666096405be140c 100644 (file)
@@ -299,7 +299,7 @@ func makeGenericReplacer(oldnew []string) *genericReplacer {
 
 type appendSliceWriter []byte
 
-// Write writes to the buffer to satisfy io.Writer.
+// Write writes to the buffer to satisfy [io.Writer].
 func (w *appendSliceWriter) Write(p []byte) (int, error) {
        *w = append(*w, p...)
        return len(p), nil
index 95180828f6b032c33b7cd5d1cd6c4f216dbba836..fba303c12a72070d9a409e60abac1d01b7fdcf95 100644 (file)
@@ -121,7 +121,7 @@ func IndexByte(s string, c byte) int {
 
 // IndexRune returns the index of the first instance of the Unicode code point
 // r, or -1 if rune is not present in s.
-// If r is utf8.RuneError, it returns the first instance of any
+// If r is [utf8.RuneError], it returns the first instance of any
 // invalid UTF-8 byte sequence.
 func IndexRune(s string, r rune) int {
        switch {
@@ -275,7 +275,7 @@ 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.
+// 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
@@ -304,7 +304,7 @@ func SplitAfterN(s, sep string, n int) []string {
 //
 // It is equivalent to [SplitN] with a count of -1.
 //
-// To split around the first instance of a separator, see Cut.
+// 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
@@ -324,7 +324,7 @@ func SplitAfter(s, sep string) []string {
 var asciiSpace = [256]uint8{'\t': 1, '\n': 1, '\v': 1, '\f': 1, '\r': 1, ' ': 1}
 
 // Fields splits the string s around each instance of one or more consecutive white space
-// characters, as defined by unicode.IsSpace, returning a slice of substrings of s or an
+// characters, as defined by [unicode.IsSpace], returning a slice of substrings of s or an
 // empty slice if s contains only white space.
 func Fields(s string) []string {
        // First count the fields.