Join Integers in Go

Posted by yhuang
Public (Editable by Users)
Go
Edit
package main

import (
	"fmt"
	"strings"
)

func main() {
	a := []int{1, 2, 3}
	str := fmt.Sprint(a)
	joined := strings.Join(strings.Split(str[1:len(str)-1], " "), "++")
	fmt.Println(joined)
}