text

package module
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2022 License: MIT Imports: 7 Imported by: 9

README

text License Go Report Card Build and Tests Codecov PkgGoDev Release GitHub go.mod Go version

Golang package with convenience functions for strings

Documentation

Overview

Package text contains convenience functions for creating strings

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FixedLength

func FixedLength(text string, length int, ellipsisOverride ...string) string

FixedLength expands or trims the given text to the provided length

func List added in v1.0.4

func List(list []string) string

List creates a list of the string entries with commas and an ending "and"

func Plural

func Plural(amount int, text ...string) string

Plural returns a string with the number and noun in either singular or plural form. If one text argument is given, the plural will be done with the plural s. If two arguments are provided, the second text is the irregular plural. If more than two are provided, then the additional ones are simply ignored.

func RandomString

func RandomString(length int) string

RandomString creates a string with random content and a given length

func RandomStringWithPrefix

func RandomStringWithPrefix(prefix string, length int) string

RandomStringWithPrefix creates a string with the provided prefix and additional random content so that the whole string has the given length.

Types

This section is empty.

Jump to

Keyboard shortcuts

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