cHelper

package module
v0.0.171 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2022 License: MIT Imports: 11 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlignStringMappingArrayFields

func AlignStringMappingArrayFields(data []map[string]string) []map[string]string

func CopyStringMapping

func CopyStringMapping(data map[string]string) (result map[string]string)

func CopyStringMappingArray

func CopyStringMappingArray(data []map[string]string) (result []map[string]string)

func EnvToBool

func EnvToBool(name string, value bool) bool

func EnvToInt

func EnvToInt(name string, value int) int

func EnvToString

func EnvToString(name string, value string) string

func InArrayFloat64

func InArrayFloat64(data float64, array []float64) bool

InArrayFloat64 判断是否在数组中,float64

func InArrayInt

func InArrayInt(data int, array []int) bool

InArrayInt 判断是否在数组中,int

func InArrayString

func InArrayString(data string, array []string) bool

InArrayString 判断是否在数组中,string

func IsEmpty added in v0.0.7

func IsEmpty(value interface{}) bool

func IsExistsPath

func IsExistsPath(path string) bool

IsExistsPath 判断文件是否存在

func IsFloat added in v0.0.7

func IsFloat(value interface{}) bool

IsFloat checks whether `value` is type of float.

func IsInt

func IsInt(value interface{}) bool

IsInt checks whether `value` is type of int.

func IsMap added in v0.0.7

func IsMap(value interface{}) bool

IsMap checks whether `value` is type of map.

func IsNil added in v0.0.7

func IsNil(value interface{}, traceSource ...bool) bool

func IsNumber

func IsNumber(s string, typ NumberType) bool

IsNumber 字符串是否为数字

func IsSlice added in v0.0.7

func IsSlice(value interface{}) bool

IsSlice checks whether `value` is type of slice.

func IsStruct added in v0.0.7

func IsStruct(value interface{}) bool

IsStruct checks whether `value` is type of struct.

func IsUint added in v0.0.7

func IsUint(value interface{}) bool

IsUint checks whether `value` is type of uint.

func Md5

func Md5(data []byte) string

func RandomInt

func RandomInt(min, max int) int

RandomInt 生成随机整数

func RandomStr

func RandomStr(length int, randomType RandomType) string

func ReplaceAll

func ReplaceAll(src string, old []string, new string) string

ReplaceAll 多个字符串同时替换为同一个

func ToBool

func ToBool(s string) bool

ToBool 字符串转布尔值

func ToFloat32

func ToFloat32(s string) float32

ToFloat32 字符串转32位浮点数

func ToFloat64

func ToFloat64(s string) float64

ToFloat64 字符串转64位浮点数

func ToInt

func ToInt(s string) int

ToInt 字符串转int

func ToInt32

func ToInt32(s string) int32

ToInt32 字符串转int32

func ToInt64

func ToInt64(s string) int64

ToInt64 字符串转int64

func ToInt8

func ToInt8(s string) int8

ToInt8 字符串转int8

func ToString

func ToString(num interface{}) string

ToString 所有类型转字符串

func ToUint

func ToUint(s string) uint

ToUint 字符串转uint

func ToUint32

func ToUint32(s string) uint32

ToUint32 字符串转uint32

func ToUint64

func ToUint64(s string) uint64

ToUint64 字符串转uint64

func ToUint8

func ToUint8(s string) uint8

ToUint8 字符串转uint8

func Ucfirst

func Ucfirst(s string) string

Ucfirst 首字母大写

func UniqueInt64

func UniqueInt64(array []int64) []int64

Types

type NumberType added in v0.0.12

type NumberType uint8
const (
	UInt NumberType = iota
	Int
	UFloat
	Float
	Positive
	Negative
	All
)

type RandomType

type RandomType uint8
const (
	RandomType_All RandomType = iota
	RandomType_Number
	RandomType_Char
	RandomType_LowerChar
	RandomType_UpperChar
	RandomType_Symbol
	RandomType_NumberAndSymbol
	RandomType_CharAndSymbol
)

Jump to

Keyboard shortcuts

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