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

     1  package stringslice
     2  
     3  import (
     4  	"gitlab.com/evatix-go/core/internal/strutilinternal"
     5  )
     6  
     7  func NonWhitespaceSlice(
     8  	slice []string,
     9  ) []string {
    10  	if slice == nil {
    11  		return []string{}
    12  	}
    13  
    14  	length := len(slice)
    15  
    16  	if length == 0 {
    17  		return []string{}
    18  	}
    19  
    20  	newSlice := MakeDefault(length)
    21  
    22  	for _, s := range slice {
    23  		if strutilinternal.IsEmptyOrWhitespace(s) {
    24  			continue
    25  		}
    26  
    27  		newSlice = append(newSlice, s)
    28  	}
    29  
    30  	return newSlice
    31  }