gitlab.com/evatix-go/core@v1.3.55/coredata/stringslice/CloneIf.go (about) 1 package stringslice 2 3 import "strings" 4 5 func CloneIf( 6 isClone bool, 7 additionalCap int, 8 slice []string, 9 ) (newSlice []string) { 10 if slice == nil && !isClone { 11 return []string{} 12 } 13 14 if !isClone { 15 return slice 16 } 17 18 return CloneUsingCap(additionalCap, slice) 19 } 20 21 func JoinWith(joiner string, items ...string) string { 22 if len(items) == 0 { 23 return "" 24 } 25 26 return joiner + strings.Join(items, joiner) 27 }