string

package
v0.0.0-...-674ef51 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CaseCamelToSnake

func CaseCamelToSnake(s string) string

func FormatFloa32

func FormatFloa32(n float32) string

FormatFloa32 returns the string representation with all of the insignificant digits removed.

For example, "001.500" becomes "1.5".

func FormatFloa64

func FormatFloa64(n float64) string

FormatFloa64 returns the string representation with all of the insignificant digits removed.

For example, "001.500" becomes "1.5".

func FormatRanges

func FormatRanges[T constraints.Integer | constraints.Float](ranges []T) string

FormatRanges formats a slice of integers into a string of ranges.

FormatRanges([]int{1, 2, 3}) // "1-3"
FormatRanges([]int{1, 2, 4}) // "1-2, 4"
FormatRanges([]int{1, 3, 5}) // "1, 3, 5"

func Quantify

func Quantify(n int, singular, plural string) string

Quantify returns a string with the quantity and the correct form of the word, depending on the quantity.

func Trim

func Trim(s string, max int) string

Trim trims a string to a maximum length, appending an ellipsis if necessary. The trimmed string with ellipsis will never be longer than max. Works with ANSI escape codes.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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