Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JoinWithConjunction ¶
JoinWithConjunction joins a slice of strings with commas except for the last two which are joined with "and".
func Truncate ¶ added in v2.5.0
func Truncate(s string, n int, opts ...TruncateOption) string
Truncate truncates s to n characters. Additional behaviors can be specified using TruncateOptions.
func UISanitize ¶ added in v2.25.0
UISanitize sanitizes a string for display in the UI. The following transformations are applied, in order: - HTML tags are removed using bluemonday's strict policy. - ANSI escape codes are stripped using stripansi. - Consecutive backslashes are replaced with a single backslash. - Non-printable characters are removed. - Whitespace characters are replaced with spaces. - Multiple spaces are collapsed into a single space. - Leading and trailing whitespace is trimmed.
Types ¶
type TruncateOption ¶ added in v2.27.1
type TruncateOption int
const ( // TruncateWithEllipsis adds a Unicode ellipsis character to the end of the string. TruncateWithEllipsis TruncateOption = 1 << 0 // TruncateWithFullWords ensures that words are not split in the middle. // As a special case, if there is no word boundary, the string is truncated. TruncateWithFullWords TruncateOption = 1 << 1 )
func (TruncateOption) String ¶ added in v2.27.1
func (o TruncateOption) String() string