mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
770 B
770 B
join
Instructions
Write a function, Join, that returns the elements of a slice strings (arstr) join together in one string. Using the string 'sep' as a separator between each element of the array
The function must have the next signature.
Expected function
func Join(arstr []string, sep string) string {
}
Usage
Here is a possible program to test your function :
package main
import (
"fmt"
student ".."
)
func main() {
arrStr := []string{"hello", "how", "are", "you"}
joined := student.Join(arrStr, "--")
fmt.Println(joined)
}
And its output :
student@ubuntu:~/student/join$ go build
student@ubuntu:~/student/join$ ./join
hello--how--are--you
student@ubuntu:~/student/join$