Logo

Programming-Idioms

History of Idiom 53 > diff from v6 to v7

Edit summary for version 7 by :

Version 6

2015-08-21, 20:35:25

Version 7

2015-08-21, 23:25:07

Idiom #53 Join a list of strings

Concatenate elements of string list x joined by the separator ", " to create a single string y.

Idiom #53 Join a list of strings

Concatenate elements of string list x joined by the separator ", " to create a single string y.

Imports
import "strings"
Imports
import "strings"
Code
y := strings.Join(x, ", ")
Code
y := strings.Join(x, ", ")
Comments bubble
This works only if x has type []string.
Comments bubble
This works only if x has type []string.
Doc URL
http://golang.org/pkg/strings/#Join
Origin
http://golang.org/pkg/strings/#Join