util

package module
v0.0.0-...-48ccccc Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2021 License: MIT Imports: 18 Imported by: 1

README

util

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeToGBK

func DecodeToGBK(text string) (string, error)

DecodeToGBK 转换成GBK

func Dial

func Dial(ip string, port int) bool

func GetWDPath

func GetWDPath() string

The GetWDPath gets the work directory path.

func IsDirExists

func IsDirExists(path string) bool

The IsDirExists judges path is directory or not.

func IsFileExists

func IsFileExists(path string) bool

The IsFileExists judges path is file or not.

func IsIP

func IsIP(ip string) bool

IsIP will match the given parameter is ip address or not.

func IsInputMatchRegex

func IsInputMatchRegex(input, regex string) bool

IsInputMatchRegex will verify the input string is match the regex or not. This function will recover the panic if regex can't be parsed.

func Load

func Load(data interface{}, filename string)

Load 加载数据

func Mkdir

func Mkdir(Path string)

创建目录

func NodeHtml

func NodeHtml(n *html.Node) string

func NodeText

func NodeText(node *html.Node) string

func RandomUA

func RandomUA() string

RandomUA 随机获取UA

func RelPath

func RelPath(targpath string) string

转相对路径

func RemoveSlice

func RemoveSlice(slice []interface{}, elem interface{}) []interface{}

RemoveSlice 删除切片中的某个元素

func RenderNode

func RenderNode(n *html.Node) string

func SplitHtml

func SplitHtml(htmStr string, maxLen int) []string

func Store

func Store(data interface{}, filename string)

Store 持久化对象

func Substr

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

Substr 截取字符串

func VerifyProxyIP

func VerifyProxyIP(url string) bool

VerifyProxyIP will use given ip and port as proxy, if the proxy is available, return true, otherwise return false.

func WalkDir

func WalkDir(targpath string, suffixes ...string) (dirlist []string)

遍历目录,可指定后缀

func WalkFiles

func WalkFiles(targpath string, suffixes ...string) (filelist []string)

遍历文件,可指定后缀

func WalkRelDir

func WalkRelDir(targpath string, suffixes ...string) (dirlist []string)

遍历目录,可指定后缀,返回相对路径

func WalkRelFiles

func WalkRelFiles(targpath string, suffixes ...string) (filelist []string)

遍历文件,可指定后缀,返回相对路径

Types

This section is empty.

Jump to

Keyboard shortcuts

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