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.
 
 
 
 

766 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$