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

     1  package stringslice
     2  
     3  import "gitlab.com/evatix-go/core/constants"
     4  
     5  // MergeNewSlicesPtrOfSlicesPtr Don't include nil or length 0 slices
     6  func MergeNewSlicesPtrOfSlicesPtr(slices *[]*[]string) *[]string {
     7  	if slices == nil {
     8  		return &[]string{}
     9  	}
    10  
    11  	sliceLength := len(*slices)
    12  
    13  	if sliceLength == constants.Zero {
    14  		return &[]string{}
    15  	}
    16  
    17  	countOfAll := AllElemLengthSlicesPtr(slices)
    18  
    19  	if countOfAll == constants.Zero {
    20  		return &[]string{}
    21  	}
    22  
    23  	newSlice := make(
    24  		[]string,
    25  		constants.Zero,
    26  		countOfAll)
    27  
    28  	for _, slice := range *slices {
    29  		if len(*slice) == constants.Zero {
    30  			continue
    31  		}
    32  
    33  		newSlice = append(newSlice, *slice...)
    34  	}
    35  
    36  	return &newSlice
    37  }