github.com/amp-space/amp-sdk-go@v0.7.6/stdlib/utils/strings.go (about)

     1  package utils
     2  
     3  func FilterEmptyStrings(s []string) []string {
     4  	var filtered []string
     5  	for i := range s {
     6  		if s[i] == "" {
     7  			continue
     8  		}
     9  		filtered = append(filtered, s[i])
    10  	}
    11  	return filtered
    12  }
    13  
    14  func TrimStringToLen(s string, length int) string {
    15  	if len(s) <= length {
    16  		return s
    17  	}
    18  	return s[:length] + "..."
    19  }