gitlab.com/evatix-go/core@v1.3.55/internal/strutilinternal/NonEmpty.go (about)

     1  package strutilinternal
     2  
     3  import "gitlab.com/evatix-go/core/constants"
     4  
     5  func NonEmptySlice(slice []string) []string {
     6  	length := len(slice)
     7  
     8  	if length == 0 {
     9  		return []string{}
    10  	}
    11  
    12  	newSlice := make(
    13  		[]string,
    14  		0,
    15  		length)
    16  
    17  	for _, s := range slice {
    18  		if s != constants.EmptyString {
    19  			newSlice = append(newSlice, s)
    20  		}
    21  	}
    22  
    23  	return newSlice
    24  }