Documentation ¶
Overview ¶
Package textutils provides common helper functions for text manipulation or output used by applications in this module.
Index ¶
- func BytesToDelimitedHexStr(bx []byte, delimiter string) string
- func DedupeList(list []string) []string
- func FailedMatches(expectedList []string, searchList []string, ignoreCase bool) []string
- func InList(needle string, haystack []string, ignoreCase bool) bool
- func InsertDelimiter(s string, delimiter string, pos int) string
- func IntSliceToStringSlice(ix []int) []string
- func LowerCaseStringSlice(xs []string) []string
- func Matches(expectedList []string, searchList []string, ignoreCase bool) ([]string, []string)
- func PrintHeader(headerText string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesToDelimitedHexStr ¶
BytesToDelimitedHexStr converts a byte slice to a delimited hex string.
func DedupeList ¶
DedupeList returns a copy of a provided string slice with all duplicate entries removed. FIXME: Is there already a standard library version of this functionality?
func FailedMatches ¶ added in v0.8.0
FailedMatches evaluates a list of values using list of expected values. A list of failed matches or an empty (non-nil) list is returned. If specified, a case-insensitive comparison is used.
func InList ¶
InList is a helper function to emulate Python's `if "x" in list:` functionality. The caller can optionally ignore case of compared items.
func InsertDelimiter ¶
InsertDelimiter inserts a delimiter into the provided string every pos characters. If the length of the provided string is less than pos + 1 characters the original string is returned unmodified as we are unable to insert delimiter between blocks of characters of specified (pos) size.
func IntSliceToStringSlice ¶
IntSliceToStringSlice converts a slice of integers to a slice of string.
func LowerCaseStringSlice ¶
LowerCaseStringSlice is a helper function to convert all provided string slice elements to lowercase.
FIXME: There is likely a better way to do this already; replace with that better way.
func Matches ¶ added in v0.8.0
Matches returns a list of successful matches and a list of failed matches for the provided lists of expected and total values. If specified, a case-insensitive comparison is used.
func PrintHeader ¶
func PrintHeader(headerText string)
PrintHeader prints a section header with liberal leading and trailing newlines to help separate otherwise potentially dense blocks of text.
Types ¶
This section is empty.