util

package
v0.0.0-...-2d91a95 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2017 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Spider The initial value of KeyIn is enabled
	UseKeyIn = "\r\t\n"
)

Variables

This section is empty.

Functions

func Atoa

func Atoa(str interface{}) string

func Atoi

func Atoi(str interface{}) int

func Atoui

func Atoui(str interface{}) uint

func Bytes2String

func Bytes2String(b []byte) string

Bytes2String direct conversion of the underlying pointer, both pointing to the same memory, change another one will change. Efficiency is string ([] byte {}) more than a hundred times, and the greater the conversion efficiency of the more obvious advantages.

func CheckErr

func CheckErr(err error)

check and print the error

func CheckErrPanic

func CheckErrPanic(err error)

func DigestString

func DigestString(s string) string

func ExcelSheetNameReplace

func ExcelSheetNameReplace(fileName string) string

Replace the illegal characters in the Excel worksheet name with the underscore

func FileNameReplace

func FileNameReplace(fileName string) string

func GetWDPath

func GetWDPath() string

The GetWDPath gets the work directory path.

func HashString

func HashString(encode string) uint64

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 IsNum

func IsNum(a string) bool

The IsNum judges string is number or not.

func JsonString

func JsonString(obj interface{}) string

change the object to a json string

func JsonpToJson

func JsonpToJson(json string) string

JsonpToJson modify jsonp string to json string example: forbar ({a: "1", b: 2}) to {"a": "1", "b": 2}

func KeyInsParse

func KeyInsParse(keyins string) []string

Cut the custom information entered by the user

func MakeHash

func MakeHash(s string) string

string to hash

func MakeMd5

func MakeMd5(obj interface{}, length int) string

Make Eigenvalue Method II

func MakeUnique

func MakeUnique(obj interface{}) string

Create eigenvalue method

func Mkdir

func Mkdir(Path string)

Create the directory

func RandomCreateBytes

func RandomCreateBytes(n int, alphabets ...byte) []byte

RandomCreateBytes generate random [] byte by specify chars.

func RelPath

func RelPath(targpath string) string

Go to the path

func SnakeCaseToCamelCase

func SnakeCaseToCamelCase(snakeCase string) (camelCase string)

func String2Bytes

func String2Bytes(s string) []byte

String2Bytes direct conversion of the underlying pointer, both pointing to the same memory, change another one will change. Efficiency is string ([] byte {}) more than a hundred times, and the greater the conversion efficiency of the more obvious advantages. After the conversion, if the other operations do not change the characters directly, the program will crash. such as b: = String2bytes ("xxx"); b [1] = 'd'; the program will panic.

func WalkDir

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

traverse the directory, you can specify the suffix

func WalkFiles

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

traverse the file, specify the suffix

func WalkRelDir

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

Traverse the directory, specify the suffix, and return the relative path

func WalkRelFiles

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

traverse the file, specify the suffix, and return the relative path

func XML2mapstr

func XML2mapstr(xmldoc string) map[string]string

simple xml to string support utf8

Types

This section is empty.

Jump to

Keyboard shortcuts

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