stringsx

package
v0.0.58-rc2 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknownCase   = errUnknownCase{}
	ErrUnknownPrefix = errUnknownPrefix{}
)

Functions

func Coalesce

func Coalesce(str ...string) string

Coalesce returns the first non-empty string value

func DefaultIfEmpty

func DefaultIfEmpty(s string, defaultValue string) string

func Random added in v0.0.40

func Random(length int) string

func SingleLine added in v0.0.3

func SingleLine(str string) string

Types

type RegisteredCases

type RegisteredCases struct {
	// contains filtered or unexported fields
}

func SwitchExact

func SwitchExact(actual string) *RegisteredCases

func (*RegisteredCases) AddCase

func (r *RegisteredCases) AddCase(c string) bool

func (*RegisteredCases) String

func (r *RegisteredCases) String() string

func (*RegisteredCases) ToUnknownCaseErr

func (r *RegisteredCases) ToUnknownCaseErr() error

type RegisteredPrefixes

type RegisteredPrefixes struct {
	// contains filtered or unexported fields
}

func SwitchPrefix

func SwitchPrefix(actual string) *RegisteredPrefixes

func (*RegisteredPrefixes) HasPrefix

func (r *RegisteredPrefixes) HasPrefix(prefix string) bool

func (*RegisteredPrefixes) String

func (r *RegisteredPrefixes) String() string

func (*RegisteredPrefixes) ToUnknownPrefixErr

func (r *RegisteredPrefixes) ToUnknownPrefixErr() error

Jump to

Keyboard shortcuts

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