blob: 7b72db5ed153c59e834e89531f46f71a32f55b07 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
package slices
import (
"fmt"
"strings"
)
// Join joins slice of any types
func Join(s interface{}, glue string) string {
if t, ok := s.([]string); ok {
return strings.Join(t, glue)
}
return strings.Trim(strings.Join(strings.Fields(fmt.Sprint(s)), glue), "[]")
}
|