Search code examples
stringgotypesstring-concatenation

golang convert "type []string" to string


I see some people create a for loop and run through the slice as to create a string, is there an easier way to convert a []string to a string?

Will sprintf do it?


Solution

  • You can use strings.Join(arr \[\]string, separator string) string.