gitlab.com/evatix-go/core@v1.3.55/coredata/stringslice/AppendAnyItemsWithStrings.go (about) 1 package stringslice 2 3 import ( 4 "fmt" 5 6 "gitlab.com/evatix-go/core/constants" 7 ) 8 9 func AppendAnyItemsWithStrings( 10 isClone, 11 isSkipOnEmpty bool, 12 mainSlice []string, 13 appendingItems ...interface{}, 14 ) []string { 15 slice := CloneIf( 16 isClone, 17 len(appendingItems)+constants.Capacity2, 18 mainSlice) 19 20 if len(appendingItems) == 0 { 21 return slice 22 } 23 24 for _, item := range appendingItems { 25 if item == nil { 26 continue 27 } 28 29 val := fmt.Sprintf( 30 constants.SprintValueFormat, 31 item) 32 33 if isSkipOnEmpty && val == "" { 34 continue 35 } 36 37 slice = append( 38 slice, 39 val) 40 } 41 42 return slice 43 }