Skip to content

Commit a52db64

Browse files
zsiecrobpike
authored andcommitted
strings: update Join parameter name for clarity
Change-Id: I83f806e76ef4d268b187bd273d78ceb41b7e8fa5 GitHub-Last-Rev: ee82eaa GitHub-Pull-Request: #36194 Reviewed-on: https://go-review.googlesource.com/c/go/+/211799 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
1 parent cae9a9f commit a52db64

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/strings/strings.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -420,24 +420,24 @@ func FieldsFunc(s string, f func(rune) bool) []string {
420420
return a
421421
}
422422

423-
// Join concatenates the elements of a to create a single string. The separator string
424-
// sep is placed between elements in the resulting string.
425-
func Join(a []string, sep string) string {
426-
switch len(a) {
423+
// Join concatenates the elements of its first argument to create a single string. The separator
424+
// string sep is placed between elements in the resulting string.
425+
func Join(elems []string, sep string) string {
426+
switch len(elems) {
427427
case 0:
428428
return ""
429429
case 1:
430-
return a[0]
430+
return elems[0]
431431
}
432-
n := len(sep) * (len(a) - 1)
433-
for i := 0; i < len(a); i++ {
434-
n += len(a[i])
432+
n := len(sep) * (len(elems) - 1)
433+
for i := 0; i < len(elems); i++ {
434+
n += len(elems[i])
435435
}
436436

437437
var b Builder
438438
b.Grow(n)
439-
b.WriteString(a[0])
440-
for _, s := range a[1:] {
439+
b.WriteString(elems[0])
440+
for _, s := range elems[1:] {
441441
b.WriteString(sep)
442442
b.WriteString(s)
443443
}

0 commit comments

Comments
 (0)