aboutsummaryrefslogtreecommitdiff
path: root/src/strings/strings.go
diff options
context:
space:
mode:
authorThomas Symborski <thomas.symborski@gmail.com>2019-12-23 23:55:43 +0000
committerRob Pike <r@golang.org>2020-01-15 04:21:28 +0000
commita52db6403c5e34ef76eb3fd01dc078718531d7bf (patch)
tree16fa9c57d195653c29651b18cb79741db8b87bb7 /src/strings/strings.go
parentcae9a9fd65cae6cbde0aacfea8f70e952e89f33e (diff)
downloadgo-a52db6403c5e34ef76eb3fd01dc078718531d7bf.tar.xz
strings: update Join parameter name for clarity
Change-Id: I83f806e76ef4d268b187bd273d78ceb41b7e8fa5 GitHub-Last-Rev: ee82eaae64536cecb631df328aafe2541f71d3f2 GitHub-Pull-Request: golang/go#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>
Diffstat (limited to 'src/strings/strings.go')
-rw-r--r--src/strings/strings.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/strings/strings.go b/src/strings/strings.go
index 69f51b6e2d..238d657f61 100644
--- a/src/strings/strings.go
+++ b/src/strings/strings.go
@@ -420,24 +420,24 @@ func FieldsFunc(s string, f func(rune) bool) []string {
return a
}
-// Join concatenates the elements of a to create a single string. The separator string
-// sep is placed between elements in the resulting string.
-func Join(a []string, sep string) string {
- switch len(a) {
+// Join concatenates the elements of its first argument to create a single string. The separator
+// string sep is placed between elements in the resulting string.
+func Join(elems []string, sep string) string {
+ switch len(elems) {
case 0:
return ""
case 1:
- return a[0]
+ return elems[0]
}
- n := len(sep) * (len(a) - 1)
- for i := 0; i < len(a); i++ {
- n += len(a[i])
+ n := len(sep) * (len(elems) - 1)
+ for i := 0; i < len(elems); i++ {
+ n += len(elems[i])
}
var b Builder
b.Grow(n)
- b.WriteString(a[0])
- for _, s := range a[1:] {
+ b.WriteString(elems[0])
+ for _, s := range elems[1:] {
b.WriteString(sep)
b.WriteString(s)
}