stringsx

package
v0.0.528 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2023 License: Apache-2.0 Imports: 4 Imported by: 57

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 added in v0.0.358

func DefaultIfEmpty(s string, defaultValue string) string

func GetPointer added in v0.0.464

func GetPointer(s string) *string

func Splitx

func Splitx(s, sep string) []string

Splitx is a special case of strings.Split which returns an empty slice if the string is empty

func ToLowerInitial added in v0.0.38

func ToLowerInitial(s string) string

ToLowerInitial converts a string's first character to lower case.

func ToUpperInitial added in v0.0.38

func ToUpperInitial(s string) string

ToUpperInitial converts a string's first character to upper case.

func TruncateByteLen added in v0.0.473

func TruncateByteLen(s string, length int) string

TruncateByteLen returns string truncated at the end with the length specified

Types

type RegisteredCases added in v0.0.167

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

func SwitchExact added in v0.0.271

func SwitchExact(actual string) *RegisteredCases

func (*RegisteredCases) AddCase added in v0.0.167

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

func (*RegisteredCases) String added in v0.0.168

func (r *RegisteredCases) String() string

func (*RegisteredCases) ToUnknownCaseErr added in v0.0.168

func (r *RegisteredCases) ToUnknownCaseErr() error

type RegisteredPrefixes added in v0.0.271

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

func SwitchPrefix added in v0.0.271

func SwitchPrefix(actual string) *RegisteredPrefixes

func (*RegisteredPrefixes) HasPrefix added in v0.0.271

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

func (*RegisteredPrefixes) String added in v0.0.271

func (r *RegisteredPrefixes) String() string

func (*RegisteredPrefixes) ToUnknownPrefixErr added in v0.0.271

func (r *RegisteredPrefixes) ToUnknownPrefixErr() error

Jump to

Keyboard shortcuts

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