util

package
v1.0.16 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NULL = ""
)

Variables

This section is empty.

Functions

func BinaryToDecimal

func BinaryToDecimal(bit string) (num int)

二进制转10进制

func ConvertToString

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

func FilterIntSlice added in v1.0.7

func FilterIntSlice(src []int, dst []int) (result []int)

过滤数组,去除src中item,在dst中存在的item src[1,2,3,4,5] dst[2,4,6,8] result[1,3,5]

func FilterSlice

func FilterSlice(src []int, dst []int) (result []int)

Deprecated

func FilterStringSlice added in v1.0.7

func FilterStringSlice(src []string, dst []string) (result []string)

过滤数组,去除src中item,在dst中存在的item src["a","b","c","d","e"] dst["b","d","f","h"] result["a","c","e"]

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 FormatURLParam added in v1.0.1

func FormatURLParam(body map[string]interface{}) (urlParam string)

func Int2String

func Int2String(intNum int) (intStr string)

Int转字符串

intNum:数字字符串

func Int642String

func Int642String(intNum int64) (int64Str string)

Int64转字符串

intNum:数字字符串

func JoinInts

func JoinInts(is []int64) string

JoinInts format int64 slice like:n1,n2,n3.

func MergeSliceRemoveDuplicate

func MergeSliceRemoveDuplicate(slice1, slice2 []int) (merged []int)

int数组合并,去重复

func RandomNumber

func RandomNumber(l int) string

随机生成数字字符串

func RandomPureString

func RandomPureString(l int) string

随机生成纯字符串

func RandomString

func RandomString(l int) string

随机生成字符串

func SplitInts

func SplitInts(s string) ([]int64, error)

SplitInts split string into int64 slice.

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:数字的字符串

func VerifyIDCard

func VerifyIDCard(idCard string) bool

计算规则参考“中国国家标准化管理委员会”官方文档:http://www.gb688.cn/bzgk/gb/newGbInfo?hcno=080D6FBF2BB468F9007657F26D60013E 身份证号码校验

func VerifyPhoneNumber

func VerifyPhoneNumber(phone string) bool

手机号码校验

Types

This section is empty.

Jump to

Keyboard shortcuts

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