stringutil

package
v1.20.91 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2024 License: Zlib Imports: 8 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ATo added in v1.3.41

func ATo(arr []interface{}) []string

func BytesTo added in v0.5.5

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

BytesTo BType not int

func BytesToUInt32 added in v1.0.37

func BytesToUInt32(bys []byte) uint32

func BytesToUInt64 added in v1.0.37

func BytesToUInt64(bys []byte) uint64

func Decimal added in v1.3.25

func Decimal(f float64) float64

func DefaultString

func DefaultString(a string, def string) string

func F64ToString added in v1.3.25

func F64ToString(a float64) string

func F64ToStringV added in v1.3.25

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

func GetChinaPhone added in v1.0.53

func GetChinaPhone(num string) string

func GetHKPhone added in v1.0.53

func GetHKPhone(num string) string

func HasChinaPhoneLegal added in v1.0.53

func HasChinaPhoneLegal(num string) bool

func HasHKPhoneLegal added in v1.0.53

func HasHKPhoneLegal(num string) bool

func HasPhoneLegal added in v1.0.53

func HasPhoneLegal(num string) bool

func Int32ToString added in v1.0.52

func Int32ToString(a int32) string

func Int64ToString

func Int64ToString(a int64) string

func IntToString

func IntToString(a int) string

func IsEmailValidate

func IsEmailValidate(email string) bool

IsEmailValidate 邮箱合规

func IsNameValidate

func IsNameValidate(name string) bool

IsNameValidate 用户名验证

func IsPhoneExtValidate added in v1.2.17

func IsPhoneExtValidate(mobile string) bool

IsPhoneExtValidate 带分机

func IsPhoneValidate

func IsPhoneValidate(mobile string) bool

IsPhoneValidate 手机验证

func NumberValue added in v0.3.9

func NumberValue(number string) (num int64, decimal float64)

func PercentIf added in v0.3.9

func PercentIf(number string) (float64, bool)

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

func StringToF64 added in v1.3.25

func StringToF64(a string) float64

func StringToF64V added in v1.3.25

func StringToF64V(a string, bitSize int) float64

func StringToInt

func StringToInt(a string) int

func StringToInt32 added in v1.0.52

func StringToInt32(a string) int32

func StringToInt64

func StringToInt64(a string) int64

func StringToUInt32 added in v1.0.52

func StringToUInt32(a string) uint32

func StringToUInt64

func StringToUInt64(a string) uint64

func ToBytes added in v0.5.5

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

func ToString added in v0.2.6

func ToString(value interface{}) string

func ToStringV2 added in v1.3.40

func ToStringV2(reflectValue reflect.Value) string

func UInt32ToBytes added in v1.0.37

func UInt32ToBytes(n uint32) []byte

func UInt32ToString added in v1.0.52

func UInt32ToString(a uint32) string

func UInt64ToBytes added in v1.0.37

func UInt64ToBytes(n uint64) []byte

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 {
	int8 | int16 | int32 | int64 |
		uint8 | uint16 | uint32 | uint64 |
		float64 | float32 | bool
}

type Builder added in v1.4.4

type Builder struct {
	strings.Builder
}

func (*Builder) WriteF64 added in v1.4.4

func (b *Builder) WriteF64(n float64) (int, error)

func (*Builder) WriteInt added in v1.4.4

func (b *Builder) WriteInt(n int) (int, error)

func (*Builder) WriteInt32 added in v1.4.4

func (b *Builder) WriteInt32(n int32) (int, error)

func (*Builder) WriteInt64 added in v1.4.4

func (b *Builder) WriteInt64(n int64) (int, error)

func (*Builder) WriteUInt added in v1.4.4

func (b *Builder) WriteUInt(n uint) (int, error)

func (*Builder) WriteUInt32 added in v1.4.4

func (b *Builder) WriteUInt32(n uint32) (int, error)

func (*Builder) WriteUInt64 added in v1.4.4

func (b *Builder) WriteUInt64(n uint64) (int, error)

type Number added in v1.3.56

type Number struct {
	Num     int64
	Decimal float64
}

func NumberWithF64 added in v1.3.56

func NumberWithF64(v float64, prec int) Number

func NumberWithI64 added in v1.3.56

func NumberWithI64(v int64) Number

func NumberWithString added in v1.3.56

func NumberWithString(number string, prec int) Number

func (Number) String added in v1.3.56

func (n Number) String() string

func (Number) ToF64 added in v1.3.56

func (n Number) ToF64(prec int) float64

func (Number) ToI64 added in v1.3.56

func (n Number) ToI64() int64

func (Number) ToString added in v1.3.56

func (n Number) ToString(prec int) string

Jump to

Keyboard shortcuts

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