stringer

package
v1.0.37 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: MIT Imports: 4 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsString

func AsString(elem fmt.Stringer) string

func AsStrings

func AsStrings(elems ...fmt.Stringer) []string

func Capitalize

func Capitalize[T ~string](s T) string

func Chunk added in v1.0.31

func Chunk[T ~string](size int, s T) []string

func Contains

func Contains[T ~string, S ~string](s S, substr T) bool

func ContainsAny

func ContainsAny[T ~string, S ~string](s S, elems ...T) bool

func ContainsAnyIgnoreCase

func ContainsAnyIgnoreCase[T ~string, S ~string](s S, elems ...T) bool

func ContainsIgnoreCase added in v1.0.31

func ContainsIgnoreCase[T ~string, S ~string](s S, substr T) bool

func ContainsNone

func ContainsNone[T ~string, S ~string](s S, elems ...T) bool

func ContainsNoneIgnoreCase

func ContainsNoneIgnoreCase[T ~string, S ~string](s S, elems ...T) bool

func EndsWith

func EndsWith[T ~string, U ~string | ~byte](s T, suffixes ...U) bool

func Equal

func Equal[T ~string](s T, v string) bool

func EqualFold

func EqualFold[T ~string](s T, v string) bool

func EqualIgnoreCase

func EqualIgnoreCase[T ~string](s T, v string) bool

func FindNonEmpty added in v1.0.26

func FindNonEmpty[T ~string](elems ...T) (T, bool)

func FindNonZero

func FindNonZero[T ~string](elems ...T) (T, bool)

func FirstNonSpace added in v1.0.37

func FirstNonSpace[T ~string | ~byte](s T) int

func HasPrefix

func HasPrefix[T ~string, U ~string](s T, prefixes ...U) bool

func HasSuffx

func HasSuffx[T ~string, U ~string | ~byte](s T, prefixes ...U) bool

func IsDefined added in v1.0.31

func IsDefined[T ~string](s T) bool

func IsEmpty

func IsEmpty[T ~string](s T) bool

func IsZero

func IsZero[T ~string](s T) bool

func Join

func Join[T ~string](sep string, elems ...T) string

func Lowercase

func Lowercase[T ~string](s T) string

func LowercaseFirst

func LowercaseFirst[T ~string](s T) string

func Remove

func Remove[T ~string](s T, remove string) string

func Replace

func Replace[T ~string](s T, new string, olds ...string) string

func Reverse

func Reverse[T ~string](s T) string

func SpaceToTab added in v1.0.37

func SpaceToTab[T ~string | ~byte](s T, tabWidth int) string

func Split

func Split[T ~string](s T, sep string) []string

func SplitAny

func SplitAny[T ~string](s T, elems ...string) []string

func SplitFn

func SplitFn[T ~string](s T, fn func(string) bool) []string

func StartsWith

func StartsWith[T ~string, U ~string](s T, prefixes ...U) bool

func TabToSpace added in v1.0.37

func TabToSpace[T ~string | ~byte](s T, tabWidth int) string

func Title

func Title[T ~string](s T) string

func ToLower

func ToLower[T ~string](s T) string

func ToLowerFirst

func ToLowerFirst[T ~string](s T) string

func ToUpper

func ToUpper[T ~string](s T) string

func ToUpperFirst

func ToUpperFirst[T ~string](s T) string

func Trim

func Trim[T ~string](s T, set string) T

func TrimFunc

func TrimFunc[T ~string](s T, fn func(rune) bool) T

func TrimFuncLeft

func TrimFuncLeft[T ~string](s T, fn func(rune) bool) T

func TrimFuncRight

func TrimFuncRight[T ~string](s T, fn func(rune) bool) T

func TrimLeft

func TrimLeft[T ~string](s T, set string) T

func TrimPrefix

func TrimPrefix[T ~string](s T, prefix string) T

func TrimRight

func TrimRight[T ~string](s T, set string) T

func TrimRunes

func TrimRunes[T ~string](s T, set ...rune) T

func TrimRunesLeft

func TrimRunesLeft[T ~string](s T, set ...rune) T

func TrimRunesRight

func TrimRunesRight[T ~string](s T, set ...rune) T

func TrimSpace

func TrimSpace[T ~string](s T) T

func TrimSpaceLeft

func TrimSpaceLeft[T ~string](s T) T

func TrimSpaceRight

func TrimSpaceRight[T ~string](s T) T

func TrimSuffix

func TrimSuffix[T ~string](s T, suffix string) T

func TruncateBegin

func TruncateBegin[T ~string](s T, w int) string

func TruncateBeginWith

func TruncateBeginWith[T ~string](s T, w int, m string) string

func TruncateEnd

func TruncateEnd[T ~string](s T, w int) string

func TruncateEndWith

func TruncateEndWith[T ~string](s T, w int, m string) string

func Uppercase

func Uppercase[T ~string](s T) string

func UppercaseFirst

func UppercaseFirst[T ~string](s T) string

Types

type Builder

type Builder[T ~string] struct {
	strings.Builder
}

func (*Builder[T]) WriteString

func (t *Builder[T]) WriteString(s T) (int, error)

Jump to

Keyboard shortcuts

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