Documentation ¶
Index ¶
- func BigIntToDecimals(amount *big.Int, decimals int32) decimal.Decimal
- func BoolToUInt(b bool) uint64
- func Bytes2Hex(d []byte) string
- func BytesToDecimals(bits []byte, decimals int32) decimal.Decimal
- func Contain(obj interface{}, target interface{}) bool
- func CopyBytes(b []byte) (copiedBytes []byte)
- func FormatStruct(v interface{}) string
- func FromHex(s string) []byte
- func Hex2Bytes(str string) []byte
- func Hex2BytesFixed(str string, flen int) []byte
- func IntToDecimals(amount int64, decimals int32) decimal.Decimal
- func IsChinaMobile(b []byte) bool
- func IsChinaMobileString(str string) bool
- func IsMail(b []byte) bool
- func IsMailString(str string) bool
- func IsNickname(b []byte) bool
- func IsNicknameString(str string) bool
- func IsNumber(b []byte) bool
- func IsNumberString(str string) bool
- func IsRealNumber(b []byte) bool
- func IsRealNumberString(str string) bool
- func IsUserName(b []byte) bool
- func IsUserNameString(str string) bool
- func LeftPadBytes(slice []byte, l int) []byte
- func RightPadBytes(slice []byte, l int) []byte
- func StringNumToBigIntWithExp(amount string, exp int32) *big.Int
- func StringValueToBigInt(value string, base int) (*big.Int, error)
- func Substr(str string, start int, end int) string
- func TimeFormat(format string, t ...time.Time) string
- func ToHex(b []byte) stringdeprecated
- func ToHexArray(b [][]byte) []string
- func ToISO8601(t ...time.Time) string
- func UIntToBool(u uint64) bool
- type FloatProtocal
- type Int
- type IntProtocal
- type String
- func (s String) AES(key string) (string, error)
- func (s String) Bool(def ...bool) bool
- func (s String) Float32(def ...float32) float32
- func (s String) Float64(def ...float64) float64
- func (s String) HmacMD5(secret string) string
- func (s String) HmacSHA1(secret string) string
- func (s String) Int(def ...int) int
- func (s String) Int16(def ...int) int16
- func (s String) Int32(def ...int) int32
- func (s String) Int64(def ...int) int64
- func (s String) Int8(def ...int) int8
- func (s String) IsEmpty() bool
- func (s String) IsNil() bool
- func (s String) Length() int
- func (s String) MD5() string
- func (s String) SHA1() string
- func (s String) SHA256() string
- func (s String) String() string
- func (s String) UInt16(def ...int) uint16
- func (s String) UInt32(def ...int) uint32
- func (s String) UInt64(def ...int) uint64
- func (s String) UInt8(def ...int) uint8
- func (s *String) UnAES(aesBase64string string, key string) error
- type StringProtocal
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BoolToUInt ¶
func BytesToDecimals ¶ added in v2.0.5
func Contain ¶
func Contain(obj interface{}, target interface{}) bool
Contain 判断obj是否在target中,target支持的类型arrary,slice,map
func FormatStruct ¶
func FormatStruct(v interface{}) string
func FromHex ¶
FromHex returns the bytes represented by the hexadecimal string s. s may be prefixed with "0x".
func Hex2BytesFixed ¶
Hex2BytesFixed returns bytes of a specified fixed length flen.
func IsChinaMobile ¶
检验是否为合法的中国手机号, 不是那么太精细 只要是 13,14,15,18 开头的 11 位数字就认为是中国手机号
func IsChinaMobileString ¶
同 func IsChinaMobile(b []byte) bool
func IsMail ¶
检验是否为合法的电子邮箱, 考虑到各个网站的 mail 要求不一样, 这里匹配比较宽松 邮箱用户名可以包含 0-9, A-Z, a-z, -, _, . 开头字母不能是 -, _, . 结尾字母不能是 -, _, . -, _, . 这三个连接字母任意两个不能连续, 如不能出现 --, __, .., -_, -., _. 邮箱的域名可以包含 0-9, A-Z, a-z, - 连接字符 - 只能出现在中间, 不能连续, 如不能 -- 支持多级域名, x@y.z, x@y.z.w, x@x.y.z.w.e
func IsNickname ¶
检验是否为合法的昵称, 合法的字符有 0-9, A-Z, a-z, _, 汉字 字符 '_' 只能出现在中间且不能重复, 如 "__"
func IsRealNumberString ¶
同 func IsRealNumber(b []byte) bool
func IsUserName ¶
检验是否为合法的用户名, 合法的字符有 0-9, A-Z, a-z, _ 第一个字母不能为 _, 0-9 最后一个字母不能为 _, 且 _ 不能连续
func LeftPadBytes ¶
LeftPadBytes zero-pads slice to the left up to length l.
func RightPadBytes ¶
RightPadBytes zero-pads slice to the right up to length l.
func TimeFormat ¶
timeFormat 格式化时间 @param format 在go中,为2006-01-02 15:04:05
func ToHexArray ¶
ToHexArray creates a array of hex-string based on []byte
func UIntToBool ¶
Types ¶
type FloatProtocal ¶
FloatProtocal 强化float的扩展方法
type IntProtocal ¶
type IntProtocal interface { Int(def ...int) int Int8(def ...int8) int8 Int16(def ...int16) int16 Int32(def ...int32) int32 Int64(def ...int64) int64 }
IntProtocal 强化int的扩展方法