textutils

package
v0.36.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package textutils provides common helper functions for text manipulation or output used by applications in this module.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToDelimitedHexStr

func BytesToDelimitedHexStr(bx []byte, delimiter string) string

BytesToDelimitedHexStr converts a byte slice to a delimited hex string.

func DedupeList

func DedupeList(list []string) []string

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 InList

func InList(needle string, haystack []string, ignoreCase bool) bool

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

func InsertDelimiter(s string, delimiter string, pos int) string

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

func IntSliceToStringSlice(ix []int) []string

IntSliceToStringSlice converts a slice of integers to a slice of string.

func LowerCaseStringSlice

func LowerCaseStringSlice(xs []string) []string

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 PrintHeader

func PrintHeader(headerText string)

PrintHeader printers a section header to help separate otherwise potentially dense blocks of text.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL