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

     1  package stringslice
     2  
     3  func NonEmptyStrings(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  	sliceNew := make([]string, 0, length)
    15  
    16  	for _, s := range slice {
    17  		if s == "" {
    18  			continue
    19  		}
    20  
    21  		sliceNew = append(sliceNew, s)
    22  	}
    23  
    24  	return sliceNew
    25  }