Documentation ¶
Index ¶
- Variables
- func BoolToString(b bool) string
- func InArray[T comparable](needle T, haystack []T) bool
- func IsEmpty(s string) bool
- func IsNotEmpty(s string) bool
- func LastFromSplit(input, split string) string
- func LcFirst(s string) string
- func Reverse(s string) string
- func Substring(s string, start, end int) (string, error)
- func ToBool(str string) bool
- func ToBoolE(str string) (bool, error)
- func ToCamel(s string) string
- func ToDelimited(s string, delim uint8) string
- func ToFloat32(str string) float32
- func ToFloat32E(str string) (float32, error)
- func ToFloat64(str string) float64
- func ToFloat64E(str string) (float64, error)
- func ToInt(str string) int
- func ToInt32(str string) int32
- func ToInt32E(str string) (int32, error)
- func ToInt64(str string) int64
- func ToInt64E(str string) (int64, error)
- func ToInt8(str string) int8
- func ToInt8E(str string) (int8, error)
- func ToIntE(str string) (int, error)
- func ToKebab(s string) string
- func ToLowerCamel(s string) string
- func ToScreamingDelimited(s string, delimiter uint8, ignore string, screaming bool) string
- func ToScreamingKebab(s string) string
- func ToSnake(s string) string
- func ToSnakeWithIgnore(s, ignore string) string
- func ToString(v interface{}) string
- func ToUint(str string) uint
- func ToUint8(str string) uint8
- func UcFirst(s string) string
- type RegisteredCases
- type RegisteredPrefixes
- type StringSet
- func (set StringSet) Add(s string)
- func (set StringSet) ApplyFunc(applyFn func(string) string) StringSet
- func (set StringSet) Clear()
- func (set StringSet) Clone() StringSet
- func (set StringSet) Contains(s string) bool
- func (set StringSet) Difference(o StringSet) StringSet
- func (set StringSet) Equals(o StringSet) bool
- func (set StringSet) FuncMatch(matchFn func(string, string) bool, matchString string) StringSet
- func (set StringSet) Intersection(o StringSet) StringSet
- func (set StringSet) IsEmpty() bool
- func (set StringSet) Len() int
- func (set StringSet) MarshalJSON() ([]byte, error)
- func (set StringSet) MarshalYAML() (interface{}, error)
- func (set StringSet) Remove(s string)
- func (set StringSet) String() string
- func (set StringSet) ToSlice() []string
- func (set StringSet) Union(o StringSet) StringSet
- func (set *StringSet) UnmarshalJSON(data []byte) error
- func (set *StringSet) UnmarshalYAML(value *yaml.Node) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrUnknownCase = errUnknownCase{} ErrUnknownPrefix = errUnknownPrefix{} )
Functions ¶
func InArray ¶
func InArray[T comparable](needle T, haystack []T) bool
InArray checks if a string is in a slice of haystack.
func LastFromSplit ¶
LastFromSplit returns the last part of a string split by a separator.
func ToBoolE ¶
ToBoolE converts a string to a bool. If the string is not a valid bool, it returns an error.
func ToDelimited ¶
func ToFloat32E ¶
ToFloat32E converts a string to float32. If the string is not a valid float32, it returns an error.
func ToFloat64E ¶
ToFloat64E converts a string to a float64. If the string is not a valid float64, it returns an error.
func ToInt32E ¶
ToInt32E converts a string to an int32. If the string is not a valid int32, it returns an error.
func ToInt64E ¶
ToInt64E converts a string to int64. If the string is not a valid int64, it returns an error.
func ToInt8E ¶
ToInt8E converts a string to int8. If the string is not a valid int8, it returns an error.
func ToLowerCamel ¶
func ToScreamingDelimited ¶
func ToScreamingKebab ¶
func ToSnakeWithIgnore ¶
Types ¶
type RegisteredCases ¶ added in v0.1.31
type RegisteredCases struct {
// contains filtered or unexported fields
}
func SwitchExact ¶ added in v0.1.31
func SwitchExact(actual string) *RegisteredCases
func (*RegisteredCases) AddCase ¶ added in v0.1.31
func (r *RegisteredCases) AddCase(cases ...string) bool
func (*RegisteredCases) String ¶ added in v0.1.31
func (r *RegisteredCases) String() string
func (*RegisteredCases) ToUnknownCaseErr ¶ added in v0.1.31
func (r *RegisteredCases) ToUnknownCaseErr() error
type RegisteredPrefixes ¶ added in v0.1.31
type RegisteredPrefixes struct {
// contains filtered or unexported fields
}
func SwitchPrefix ¶ added in v0.1.31
func SwitchPrefix(actual string) *RegisteredPrefixes
func (*RegisteredPrefixes) HasPrefix ¶ added in v0.1.31
func (r *RegisteredPrefixes) HasPrefix(prefixes ...string) bool
func (*RegisteredPrefixes) String ¶ added in v0.1.31
func (r *RegisteredPrefixes) String() string
func (*RegisteredPrefixes) ToUnknownPrefixErr ¶ added in v0.1.31
func (r *RegisteredPrefixes) ToUnknownPrefixErr() error
type StringSet ¶ added in v0.1.33
type StringSet map[string]struct{}