Documentation ¶
Index ¶
- Constants
- Variables
- func Coalesce(v ...string) string
- func CollapseSpaces(s string) string
- func Hexdump(w io.Writer, b []byte, cols int)
- func IdentizeString(s string) string
- func Indent(s, p string) string
- func IndentWithOptions(s, p string, opt IndentOptions) string
- func NewIndentWriter(p string, opt IndentOptions, w io.Writer) io.Writer
- func NormalizeDiacritics(s string) string
- func NormalizeJoin(l []string, d, f string) string
- func NormalizeString(s string) string
- func NormalizeTerms(s string) string
- func ParseRanges(s string, b []int) ([][]int, error)
- func ParseRangesFunc(s string, b []int, d string, c NumberParser) ([][]int, error)
- func Stringer(v interface{}) string
- func StripControl(s string) string
- func Truncate(s string, n int, x string) string
- type IndentOptions
- type NumberParser
Constants ¶
const ( IndentOptionNone = 0 IndentOptionIndentFirstLine = 1 << 0 )
Variables ¶
var ErrEmptyInput = fmt.Errorf("Empty input")
Errors
Functions ¶
func Hexdump ¶
Write a string in the manner of the output of `hexdump -C`, with byte values on the left corresponding to characters on the right, when printable
func IndentWithOptions ¶
func IndentWithOptions(s, p string, opt IndentOptions) string
Indent a string by prefixing each line with the provided string
func NewIndentWriter ¶
Create an indent writer
func NormalizeDiacritics ¶
Convert characters with diacritical marks to their unaccented/base counterparts. See also: http://stackoverflow.com/questions/26722450/remove-diacritics-using-go
func NormalizeJoin ¶
Normalize a list, using a special final delimiter between the last two elements.
func NormalizeString ¶
Normalize a string for general purpose matching
func ParseRanges ¶
Parse a series of ranges from text. Multiple ranges can be represented in a comma-delimited list. Individual numbers in the list are treated as a range that includes only that number.
An empty bound in a range is interpreted as "all the numbers from the constraining bound to the other bound". For example, the range "-10", with constraining bounds of [0, 100] means the range "0-10".
Contiguous ranges are merged together.
For example, the input: 0-5,5,6,7,8-10 produces: [[0,10]]
And the input: 0-5,7,9-10 produces: [[0,5],[7,7],[9,10]]
func ParseRangesFunc ¶
Parse ranges where the values are parsed by a function