stringutil

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2022 License: Zlib Imports: 8 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayToInt added in v0.4.3

func ArrayToInt(arr []interface{}) []int

func BytesTo added in v0.5.5

func BytesTo[T BType](bys []byte, def T) T

func BytesToInt

func BytesToInt(bys []byte) int

func BytesToInt64

func BytesToInt64(bys []byte) int64

func DefaultString

func DefaultString(a string, def string) string

func Float64ToString

func Float64ToString(a float64, prec, bitSize int) string

func Int64ToBytes

func Int64ToBytes(n int64) []byte

func Int64ToString

func Int64ToString(a int64) string

func IntToBytes

func IntToBytes(n int) []byte

func IntToString

func IntToString(a int) string

func IsEmailValidate

func IsEmailValidate(email string) bool

IsEmailValidate 邮箱合规

func IsNameValidate

func IsNameValidate(name string) bool

IsNameValidate 用户名验证

func IsPhoneValidate

func IsPhoneValidate(mobile string) bool

IsPhoneValidate 手机验证

func NumberValue added in v0.3.9

func NumberValue(number string) (num, decimal int)

func PercentIf added in v0.3.9

func PercentIf(number string) (int, bool)

PercentIf 是否按比例分,是返回,比例值,true

func StringToInt

func StringToInt(a string) int

func StringToInt64

func StringToInt64(a string) int64

func StringToUInt64

func StringToUInt64(a string) uint64

func StringsToInt added in v0.4.3

func StringsToInt(arr []string) []int

func ToBytes added in v0.5.5

func ToBytes[T BType](n T) []byte

func ToFloat64 added in v0.3.9

func ToFloat64(value interface{}) float64

func ToInt64 added in v0.3.9

func ToInt64(value interface{}) int64

func ToString added in v0.2.6

func ToString(value interface{}) string

func ToUInt64 added in v0.3.9

func ToUInt64(value interface{}) uint64

func UInt64ToString

func UInt64ToString(a uint64) string

func Uuid

func Uuid() string

func UuidNot

func UuidNot() string

Types

type BType added in v0.5.5

type BType interface {
	int | int8 | int16 | int32 | int64 |
		uint | uint8 | uint16 | uint32 | uint64 |
		float64 | float32 | bool
}

Jump to

Keyboard shortcuts

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