Join
- join
package main
import (
"fmt"
"strings"
)
func main() {
shortStrings := []string{"abc", "def", "hello", "world"}
text := strings.Join(shortStrings, "-")
fmt.Println(text)
}
abc-def-hello-world
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
package main
import (
"fmt"
"strings"
)
func main() {
shortStrings := []string{"abc", "def", "hello", "world"}
text := strings.Join(shortStrings, "-")
fmt.Println(text)
}
abc-def-hello-world