gitlab.com/evatix-go/core@v1.3.55/coredata/stringslice/AppendStringsWithMainSlice.go (about)

     1  package stringslice
     2  
     3  func AppendStringsWithMainSlice(
     4  	isSkipEmpty bool,
     5  	mainSlice []string,
     6  	appendingItems ...string,
     7  ) []string {
     8  	if len(appendingItems) == 0 {
     9  		return mainSlice
    10  	}
    11  
    12  	for _, item := range appendingItems {
    13  		if isSkipEmpty && item == "" {
    14  			continue
    15  		}
    16  
    17  		mainSlice = append(
    18  			mainSlice,
    19  			item)
    20  	}
    21  
    22  	return mainSlice
    23  }