mp_dt

package
v0.0.0-...-5b025be Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

README

数据类型处理函数

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrFlipInt

func ArrFlipInt(s []int) []int

ArrFlipInt 翻转数组

func BytesJoin

func BytesJoin(pBytes ...[]byte) []byte

BytesJoin 多个[]byte合成一个

func BytesToUInt

func BytesToUInt(b []byte) (int, error)

BytesToUInt 字节转换成整形,字节数(大端)组转成int(无符号的)

func ChkInt

func ChkInt(t string, num int64) bool

ChkInt 检测字符串是否符合正则标准

func ChkStr

func ChkStr(t string, str string) bool

ChkStr 检测字符串是否符合正则标准

func Duplicate

func Duplicate(a interface{}) (ret []interface{})

Duplicate map,数组列表去重

func Empty

func Empty(inStr interface{}) bool

Empty 判断字符串是否为空,去掉空格

func GbkToUtf8

func GbkToUtf8(src []byte) ([]byte, error)

func GetStringArrayRand

func GetStringArrayRand(s []string) (r string)

GetStringArrayRand 随机获取字符串数组中的一个值返回

func Implode

func Implode(delimiter string, arr []string) string

Implode 按照字符串数组拼接成需要的字符串

func ImplodeInt

func ImplodeInt(delimiter string, arr []int) string

ImplodeInt 按照整数数组拼接成需要的字符串

func InArray

func InArray(node interface{}, nodes interface{}) bool

InArray 判断是否在数组里

func InArrayInt

func InArrayInt(node int, nodes []int) bool

InArrayInt 判断是否在数组里 int

func InArrayString

func InArrayString(node string, nodes []string) bool

InArrayString 判断是否在数组里 string

func IpIntToString

func IpIntToString(ipInt int) string

IpIntToString int类型的IP地址转换为正常IP地址

func IpMaskToInt

func IpMaskToInt(netmask string) (int, error)

IpMaskToInt 子网掩码转数字

func Ipv4MaskString

func Ipv4MaskString(m []byte) string

Ipv4MaskString byte格式IP转string

func IsLanIp

func IsLanIp(ip string) bool

IsLanIp 判断IP是不是内网

func JsonMarshal

func JsonMarshal(st interface{}) []byte

JsonMarshal 结构体转换为json忽略错误

func MapExist

func MapExist(key string, mp map[string]string) bool

MapExist 判断map键值是否存在

func ParseInt

func ParseInt(s string) int

ParseInt 转换string为int

func ParseIpv4

func ParseIpv4(ip string) (string, int)

ParseIpv4 转换IP+端口为IP ,端口

func StrSplit

func StrSplit(str string, ls int) (s []string)

StrSplit 字符串按照指定长度分隔到slice里

func StrToIp

func StrToIp(ip string) net.IP

StrToIp 把字符串的IP转换为IP类型

func StrToIpPort

func StrToIpPort(addr string) (ip net.IP, port int)

StrToIpPort 字符串的IP:端口转换为网络格式

func StrToUdpAddr

func StrToUdpAddr(addr string) (udpAddr *net.UDPAddr)

StrToUdpAddr 字符串的IP:端口转换为网络格式

func StringIpToInt

func StringIpToInt(ipStr string) int

StringIpToInt IP地址转换为int格式

func Substr

func Substr(str string, start int, end int) string

Substr 截取字符串 start 起点下标 end 终点下标(不包括)

func UIntToBytes

func UIntToBytes(n int, b byte) ([]byte, error)

UIntToBytes 整形转换成字节

func Utf8ToGbk

func Utf8ToGbk(src []byte) ([]byte, error)

Types

type IpRangeAreaSt

type IpRangeAreaSt struct {
	Num      int
	First    net.IP
	Last     net.IP
	FirstInt int
	LastInt  int
}

IpRangeAreaSt 接续出来的Ip范围

func IpTransRange

func IpTransRange(ipArea string) (ipRange IpRangeAreaSt, err error)

IpTransRange 根据IP的CIDR或IP范围,返回第一个和最后一个IP

Jump to

Keyboard shortcuts

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