util

package
v1.5.41 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TimeLayout   = "2006-01-02 15:04:05"
	TimeLayout_2 = "20060102150405"
	DateLayout   = "2006-01-02"
	NULL         = ""
)

Variables

This section is empty.

Functions

func BinaryToDecimal

func BinaryToDecimal(bit string) (num int)

二进制转10进制

func BytesToString added in v1.5.28

func BytesToString(b []byte) (s string)

BytesToString 0 拷贝转换 slice byte 为 string

func ConvertToString added in v1.5.29

func ConvertToString(v interface{}) (str string)

func Float32ToString

func Float32ToString(floatNum float32, prec ...int) (floatStr string)

Float32转字符串

floatNum:float32数字
prec:精度位数(不传则默认float数字精度)

func Float64ToString

func Float64ToString(floatNum float64, prec ...int) (floatStr string)

Float64转字符串

floatNum:float64数字
prec:精度位数(不传则默认float数字精度)

func GetRandomNumber

func GetRandomNumber(l int) string

随机生成数字字符串

func GetRandomPureString

func GetRandomPureString(l int) string

随机生成纯字符串

func GetRandomString

func GetRandomString(l int) string

随机生成字符串

func Int2String

func Int2String(intNum int) (intStr string)

Int转字符串

intNum:数字字符串

func Int642String

func Int642String(intNum int64) (int64Str string)

Int64转字符串

intNum:数字字符串

func String2Float32

func String2Float32(floatStr string) (floatNum float32)

字符串转Float32

floatStr:小数点数字的字符串

func String2Float64

func String2Float64(floatStr string) (floatNum float64)

字符串转Float64

floatStr:小数点数字的字符串

func String2Int

func String2Int(intStr string) (intNum int)

字符串转Int

intStr:数字的字符串

func String2Int64

func String2Int64(intStr string) (int64Num int64)

字符串转Int64

intStr:数字的字符串

Types

type File added in v1.5.41

type File struct {
	Name    string `json:"name"`
	Content []byte `json:"content"`
}

Jump to

Keyboard shortcuts

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