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