util

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: AGPL-3.0 Imports: 28 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayToString

func ArrayToString(arr []string) string

ArrayToString 数组转字符串,空格分开

func Base64Encode

func Base64Encode(braw []byte) []byte

func BytesToString

func BytesToString(b []byte) string

func CheckErrs

func CheckErrs(err error) bool

func Cidr2IPs

func Cidr2IPs(cidr string) []string

Cidr2IPs C段转ip

func Contains

func Contains(stringA, stringB string) bool

func CvtLines

func CvtLines(s string) []string

func DecodeBase64 added in v0.3.1

func DecodeBase64(i string) ([]byte, error)

func DecodeHex added in v0.3.1

func DecodeHex(i string) ([]byte, error)

func Difference

func Difference(slice1, slice2 []string) []string

func EncodeBase64 added in v0.3.1

func EncodeBase64(i interface{}) string

func Exists

func Exists(path string) bool

Exists 判断所给路径文件/文件夹是否存在

func FaviconHash

func FaviconHash(data []byte) int32

func FirstToUpper

func FirstToUpper(str string) string

FirstToUpper 字符串首字母大写

func FormatTarget

func FormatTarget(target string) (targets []string)

func Hostname

func Hostname(target string) string

func In

func In(target string, strs []string) bool

In 判断一个字符串是否在另一个字符数组里面,存在返回true target 中是否包含 strs 中的某一个 这个是 target 范围大, element只是一个子串

func In1

func In1(target string, strs []string) bool

In1 这个是 element 范围大, target 只是一个子串

func InMap added in v0.3.1

func InMap(target string, strs map[string]string) bool

func InSlice added in v0.3.1

func InSlice(slice []string, word string) bool

func InsertInto

func InsertInto(s string, interval int, sep rune) string

func IntInSlice

func IntInSlice(i int, slice []int) bool

func IsBlackHtml added in v0.3.1

func IsBlackHtml(str string) bool

func IsDir

func IsDir(path string) bool

IsDir 判断所给路径是否为文件夹

func IsFile

func IsFile(path string) bool

IsFile 判断所给路径是否为文件

func IsIPv6

func IsIPv6(ip string) bool

IsIPv6 returns true when the provided net.IP address is an IPv6 address.

func IsInnerIP

func IsInnerIP(ip string) bool

IsInnerIP 判断是否为内网IP

func MD5

func MD5(str string) string

MD5 获取字符串md5

func MapToJson added in v0.3.1

func MapToJson(param http.Header) string

func MatchAnyOfRegexp

func MatchAnyOfRegexp(regexps []string, match string) (bool, string)

func Mmh3Hash32

func Mmh3Hash32(raw []byte) int32

Mmh3Hash32 计算 mmh3 hash

func RandomFromChoices added in v0.3.1

func RandomFromChoices(n int, choices string) string

RandomFromChoices 从choices里面随机获取

func RandomLetterNumbers added in v0.3.1

func RandomLetterNumbers(n int) string

RandomLetterNumbers 随机大小写字母和数字

func RandomLetters added in v0.3.1

func RandomLetters(n int) string

RandomLetters 随机小写字母

func RandomLowLetterNumber added in v0.3.1

func RandomLowLetterNumber(n int) string

RandomLowLetterNumber 随机小写字母和数字

func RandomNumber added in v0.3.1

func RandomNumber(n int, m int) int

RandomNumber 随机数字

func RandomString added in v0.3.1

func RandomString(n int) string

RandomString 随机大小写字母

func RandomUpper

func RandomUpper(s string) string

func ReadFileAsLine

func ReadFileAsLine(path string) ([]string, error)

ReadFileAsLine 读取文件并返回一个字符串切片

func RemoveDuplicateElement added in v0.3.1

func RemoveDuplicateElement(strs []string) []string

RemoveDuplicateElement 数组去重

func ReverseString

func ReverseString(s string) string

ReverseString 反转字符串 style --> elyts

func StringToBytes

func StringToBytes(s string) []byte

func StructToJsonString

func StructToJsonString(item interface{}) string

StructToJsonString 将结构体输出位 json 字符

func StructureIps

func StructureIps(ipsTmp []string, num int) (ips []string)

func ToStringSlice

func ToStringSlice(actual interface{}) ([]string, error)

func ToUpper

func ToUpper(a []string) []string

func Trim

func Trim(s string) string

func UUID

func UUID() string

func WriteFile

func WriteFile(path string, data []byte) error

Types

type UserPass

type UserPass struct {
	Username string
	Password string
}

func CvtUps

func CvtUps(s string) []UserPass

Jump to

Keyboard shortcuts

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