Documentation ¶
Overview ¶
pstrings provides FilteredJoin QuoteList StrSliceContains
Index ¶
- func FilteredJoin(sList []string, separator ...string) (line string)
- func FilteredJoinWithHeading(sList []string, separator ...string) (line string)
- func Fit(s string, width int, pad bool) (s2 string)
- func FitValueAndLabel(width int, value, label string, pad bool) (s string)
- func IsDefaultValue(pt interface{}) (isDefault bool)
- func QuoteList(strs []string) string
- func StrSliceContains(ss []string, s string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilteredJoin ¶
FilteredJoin is like strings.Join but ignores empty strings. defauklt separator is single space \x20
func FilteredJoinWithHeading ¶ added in v0.4.28
FilteredJoinWithHeading takes a string slice of heading-value pairs and only outputs those strings that are non-empty. {"head1", "first", "head2, ""} → "head1: first"
func Fit ¶ added in v0.4.30
Fit return a string fitted to certain column width
- if width < 1, no change
- if s’ length equals width, no change
- if s’ length less than width, pad with spaces if pad true, otherwise no change
- otherwise cut s in the center and replace with single epsilon "…" character
func FitValueAndLabel ¶ added in v0.4.34
fitValueAndLabel trums a value and its label to fit into width
- if pad is true and result shorter than width, s is padded with spaces to reach width
func IsDefaultValue ¶
func IsDefaultValue(pt interface{}) (isDefault bool)
func StrSliceContains ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.