str

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2022 License: MIT Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolToString

func BoolToString(b bool) string

BoolToString converts a bool to a string.

func InArray

func InArray[T comparable](needle T, haystack []T) bool

InArray checks if a string is in a slice of haystack.

func IsEmpty

func IsEmpty(s string) bool

IsEmpty checks if a string is empty.

func IsNotEmpty

func IsNotEmpty(s string) bool

IsNotEmpty checks if a string is not empty.

func LastFromSplit

func LastFromSplit(input, split string) string

LastFromSplit returns the last part of a string split by a separator.

func LcFirst

func LcFirst(s string) string

LcFirst returns a copy of s with each word lowercased.

func Reverse

func Reverse(s string) string

Reverse returns its argument string reversed rune-wise left to right.

func Substring

func Substring(s string, start int, end int) (string, error)

Substring returns a substring of a string.

func ToBool

func ToBool(str string) bool

ToBool converts a string to a bool.

func ToBoolE

func ToBoolE(str string) (bool, error)

ToBoolE converts a string to a bool. If the string is not a valid bool, it returns an error.

func ToCamel

func ToCamel(s string) string

func ToDelimited

func ToDelimited(s string, delim uint8) string

func ToFloat32

func ToFloat32(str string) float32

ToFloat32 converts a string to float32

func ToFloat32E

func ToFloat32E(str string) (float32, error)

ToFloat32E converts a string to float32. If the string is not a valid float32, it returns an error.

func ToFloat64

func ToFloat64(str string) float64

ToFloat64 converts a string to a float64.

func ToFloat64E

func ToFloat64E(str string) (float64, error)

ToFloat64E converts a string to a float64. If the string is not a valid float64, it returns an error.

func ToInt

func ToInt(str string) int

ToInt converts a string to an int.

func ToInt32

func ToInt32(str string) int32

ToInt32 converts a string to an int32.

func ToInt32E

func ToInt32E(str string) (int32, error)

ToInt32E converts a string to an int32. If the string is not a valid int32, it returns an error.

func ToInt64

func ToInt64(str string) int64

ToInt64 converts a string to int64

func ToInt64E

func ToInt64E(str string) (int64, error)

ToInt64E converts a string to int64. If the string is not a valid int64, it returns an error.

func ToInt8

func ToInt8(str string) int8

ToInt8 converts a string to int8

func ToInt8E

func ToInt8E(str string) (int8, error)

ToInt8E converts a string to int8. If the string is not a valid int8, it returns an error.

func ToIntE

func ToIntE(str string) (int, error)

ToIntE converts a string to an int.

func ToKebab

func ToKebab(s string) string

func ToLowerCamel

func ToLowerCamel(s string) string

func ToScreamingDelimited

func ToScreamingDelimited(s string, delimiter uint8, ignore string, screaming bool) string

func ToScreamingKebab

func ToScreamingKebab(s string) string

func ToSnake

func ToSnake(s string) string

func ToSnakeWithIgnore

func ToSnakeWithIgnore(s string, ignore string) string

func ToString

func ToString(v interface{}) string

ToString converts any value to a string.

func ToUint

func ToUint(str string) uint

ToUint converts a string to uint, if the string is not a valid uint, it returns an error. this functionx is based on

func ToUint8

func ToUint8(str string) uint8

ToUint8 converts a string to uint8

func UcFirst

func UcFirst(s string) string

UcFirst returns a copy of s with each word capitalized.

Types

This section is empty.

Jump to

Keyboard shortcuts

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