1
0
mirror of https://github.com/golang/go synced 2024-11-22 22: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:
Michal Bohuslávek 2022-08-18 11:02:38 +02:00 committed by Gopher Robot
parent 2e06019dcd
commit 5f0170f9a5
2 changed files with 2 additions and 2 deletions

View File

@ -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
} }

View File

@ -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
} }