text

package
v2.49.2 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisplayURL

func DisplayURL(urlStr string) string

DisplayURL returns a copy of the string urlStr removing everything except the hostname and path. If there is an error parsing urlStr then urlStr is returned without modification.

func DisplayWidth

func DisplayWidth(s string) int

func FormatSlice added in v2.49.2

func FormatSlice(values []string, lineLength uint, indent uint, prependWith string, appendWith string, sort bool) string

FormatSlice concatenates elements of the given string slice into a well-formatted, possibly multiline, string with specific line length limit. Elements can be optionally surrounded by custom strings (e.g., quotes or brackets). If the lineLength argument is non-positive, no line length limit will be applied.

func FuzzyAgo

func FuzzyAgo(a, b time.Time) string

func FuzzyAgoAbbr

func FuzzyAgoAbbr(a, b time.Time) string

FuzzyAgoAbbr is an abbreviated version of FuzzyAgo. It returns a human readable string of the time duration between a and b that is estimated to the nearest unit of time.

func Indent

func Indent(s, indent string) string

func PadRight added in v2.38.0

func PadRight(maxWidth int, s string) string

func Pluralize

func Pluralize(num int, thing string) string

func RemoveDiacritics added in v2.28.0

func RemoveDiacritics(value string) string

RemoveDiacritics returns the input value without "diacritics", or accent marks

func RemoveExcessiveWhitespace

func RemoveExcessiveWhitespace(s string) string

RemoveExcessiveWhitespace returns a copy of the string s with excessive whitespace removed.

func Title

func Title(s string) string

Title returns a copy of the string s with all Unicode letters that begin words mapped to their Unicode title case.

func Truncate

func Truncate(maxWidth int, s string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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