mirror of
https://github.com/golang/go
synced 2024-11-18 22:24:50 -07:00
bytes, strings: use "reports whether" in HasPrefix and HasSuffix
Update the doc comments to use the more idiomatic and common phrase "reports whether" instead of "tests whether". Change-Id: I2b7f8cce2d192f66e296ebaa9b37f37e8276b4ae Reviewed-on: https://go-review.googlesource.com/c/go/+/524898 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Matthew Dempsky <mdempsky@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
7a4787d12a
commit
62fb281cf7
@ -552,12 +552,12 @@ func Join(s [][]byte, sep []byte) []byte {
|
|||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
// HasPrefix tests whether the byte slice s begins with prefix.
|
// HasPrefix reports whether the byte slice s begins with prefix.
|
||||||
func HasPrefix(s, prefix []byte) bool {
|
func HasPrefix(s, prefix []byte) bool {
|
||||||
return len(s) >= len(prefix) && Equal(s[0:len(prefix)], prefix)
|
return len(s) >= len(prefix) && Equal(s[0:len(prefix)], prefix)
|
||||||
}
|
}
|
||||||
|
|
||||||
// HasSuffix tests whether the byte slice s ends with suffix.
|
// HasSuffix reports whether the byte slice s ends with suffix.
|
||||||
func HasSuffix(s, suffix []byte) bool {
|
func HasSuffix(s, suffix []byte) bool {
|
||||||
return len(s) >= len(suffix) && Equal(s[len(s)-len(suffix):], suffix)
|
return len(s) >= len(suffix) && Equal(s[len(s)-len(suffix):], suffix)
|
||||||
}
|
}
|
||||||
|
@ -458,12 +458,12 @@ func Join(elems []string, sep string) string {
|
|||||||
return b.String()
|
return b.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
// HasPrefix tests whether the string s begins with prefix.
|
// HasPrefix reports whether the string s begins with prefix.
|
||||||
func HasPrefix(s, prefix string) bool {
|
func HasPrefix(s, prefix string) bool {
|
||||||
return len(s) >= len(prefix) && s[0:len(prefix)] == prefix
|
return len(s) >= len(prefix) && s[0:len(prefix)] == prefix
|
||||||
}
|
}
|
||||||
|
|
||||||
// HasSuffix tests whether the string s ends with suffix.
|
// HasSuffix reports whether the string s ends with suffix.
|
||||||
func HasSuffix(s, suffix string) bool {
|
func HasSuffix(s, suffix string) bool {
|
||||||
return len(s) >= len(suffix) && s[len(s)-len(suffix):] == suffix
|
return len(s) >= len(suffix) && s[len(s)-len(suffix):] == suffix
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user