2019-04-24 17:17:07 +00:00
## join
2019-04-24 17:06:54 +00:00
2019-04-24 17:17:07 +00:00
### Instructions
2019-04-24 17:06:54 +00:00
2021-10-14 11:43:13 +00:00
Write a function that returns the concatenation of all the `string` s of a slice of `string` s **separated** by the separator passed as the argument `sep` .
2019-04-24 17:06:54 +00:00
2019-04-24 17:17:07 +00:00
### Expected function
2019-04-24 17:06:54 +00:00
```go
func Join(strs []string, sep string) string {
}
```
2019-04-24 17:17:07 +00:00
### Usage
2019-04-24 17:06:54 +00:00
2020-02-25 12:02:16 +00:00
Here is a possible program to test your function :
2019-04-24 17:06:54 +00:00
```go
package main
import (
"fmt"
2021-05-02 15:18:17 +00:00
"piscine"
2019-04-24 17:06:54 +00:00
)
func main() {
toConcat := []string{"Hello!", " How", " are", " you?"}
fmt.Println(piscine.Join(toConcat, ":"))
}
```
And its output :
```console
2021-04-28 09:47:34 +00:00
$ go run .
2019-04-24 17:06:54 +00:00
Hello!: How: are: you?
2021-04-28 09:47:34 +00:00
$
2019-04-24 17:06:54 +00:00
```
2021-06-07 17:05:53 +00:00
### Notions
- [strings/Join ](https://golang.org/pkg/strings/#Join )