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

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