gitlab.com/evatix-go/core@v1.3.55/coredata/stringslice/SplitTrimmedNonEmpty.go (about) 1 package stringslice 2 3 import "strings" 4 5 // SplitTrimmedNonEmpty 6 // 7 // The count determines the number of substrings to return: 8 // n > 0: at most n substrings; the last substring will be the unsplit remainder. 9 // n == 0: the result is nil (zero substrings) 10 // n < 0: all substrings 11 func SplitTrimmedNonEmpty( 12 content, 13 splitter string, 14 number int, 15 ) []string { 16 items := strings.SplitN( 17 content, 18 splitter, 19 number) 20 21 if len(items) == 0 { 22 return []string{} 23 } 24 25 return NonWhitespaceTrimSlice(items) 26 }