mirror of
https://github.com/golang/go
synced 2024-11-23 02:10:03 -07:00
bytes, strings: s/after/before/ in CutSuffix
This follows on CL 407176 which added this function (in both packages). This CL makes it consistent with the Cut function, which uses “before” and “after” in return variable names. Change-Id: Id4345d2fe0f50bf301a880803e87bf356986b518 Reviewed-on: https://go-review.googlesource.com/c/go/+/424922 Run-TryBot: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
parent
2e06019dcd
commit
5f0170f9a5
@ -1329,7 +1329,7 @@ func CutPrefix(s, prefix []byte) (after []byte, found bool) {
|
|||||||
// If suffix is the empty byte slice, CutSuffix returns s, true.
|
// If suffix is the empty byte slice, CutSuffix returns s, true.
|
||||||
//
|
//
|
||||||
// CutSuffix returns slices of the original slice s, not copies.
|
// CutSuffix returns slices of the original slice s, not copies.
|
||||||
func CutSuffix(s, suffix []byte) (after []byte, found bool) {
|
func CutSuffix(s, suffix []byte) (before []byte, found bool) {
|
||||||
if !HasSuffix(s, suffix) {
|
if !HasSuffix(s, suffix) {
|
||||||
return s, false
|
return s, false
|
||||||
}
|
}
|
||||||
|
@ -1223,7 +1223,7 @@ func CutPrefix(s, prefix string) (after string, found bool) {
|
|||||||
// and reports whether it found the suffix.
|
// and reports whether it found the suffix.
|
||||||
// If s doesn't end with suffix, CutSuffix returns s, false.
|
// If s doesn't end with suffix, CutSuffix returns s, false.
|
||||||
// If suffix is the empty string, CutSuffix returns s, true.
|
// If suffix is the empty string, CutSuffix returns s, true.
|
||||||
func CutSuffix(s, suffix string) (after string, found bool) {
|
func CutSuffix(s, suffix string) (before string, found bool) {
|
||||||
if !HasSuffix(s, suffix) {
|
if !HasSuffix(s, suffix) {
|
||||||
return s, false
|
return s, false
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user