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

     1  package stringslice
     2  
     3  func NonEmptySlicePtr(slice *[]string) *[]string {
     4  	if slice == nil {
     5  		return &[]string{}
     6  	}
     7  
     8  	length := len(*slice)
     9  
    10  	if length == 0 {
    11  		return &[]string{}
    12  	}
    13  
    14  	newSlice := MakeDefault(length)
    15  
    16  	for _, s := range *slice {
    17  		if s != "" {
    18  			newSlice = append(newSlice, s)
    19  		}
    20  	}
    21  
    22  	return &newSlice
    23  }