util

package
v0.0.0-...-6af97ad Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2018 License: Apache-2.0 Imports: 18 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64D

func Base64D(urlxxstring string) string

字符串base64解密

func Base64E

func Base64E(urlstring string) string

字符串base64加密

func ComputeHmac256

func ComputeHmac256(message string, secret string) string

HMAC with the SHA256 http://blog.csdn.net/js_sky/article/details/49024959

func CopyFF

func CopyFF(src io.Reader, dst io.Writer) error

File-File复制文件

func CopyFS

func CopyFS(src io.Reader, dst string) error

File-String复制文件

func CurDir

func CurDir() string

获取调用者的当前文件DIR Get the caller now directory

func DevideStringList

func DevideStringList(files []string, num int) (map[int][]string, error)

change by python

func FileExist

func FileExist(filename string) bool

func FileStatus

func FileStatus(filepath string)

文件状态

func GetBinaryCurrentPath

func GetBinaryCurrentPath() (string, error)

获取当前执行二进制所在的位置

func GetCurrentPath

func GetCurrentPath() (string, error)

获取当前执行命令所在的位置

func GetDateTimes2Second

func GetDateTimes2Second(datestring string) int64

func GetFileSuffix

func GetFileSuffix(f string) string

获取文件后缀

func GetFilenameInfo

func GetFilenameInfo(filepath string) (os.FileInfo, error)

Get file info

func GetSecond2DateTimes

func GetSecond2DateTimes(secord int64) string

201611112113

func GetSecondTimes

func GetSecondTimes() int64

func GetTimestamp

func GetTimestamp() int64

Get Timestamp

func HasFile

func HasFile(s string) bool

判断文件或文件夹是否存在

func IS

func IS(i int) string

int to string

func InArray

func InArray(sa []string, a string) bool

字符串是否在字符串数组中

func Input

func Input(say, defaults string) string

func IsDir

func IsDir(filepath string) bool

判断是否是文件夹

func IsFile

func IsFile(filepath string) bool

判断是否是文件

func JsonBack

func JsonBack(s []byte) ([]byte, error)

最好的方法

func JsonEncode

func JsonEncode(raw string) string

将JSON中的/u unicode乱码转回来,笨方法,弃用

func ListDir

func ListDir(dirPth string, suffix string) (files []string, err error)

列出文件夹下非递归文件全称

func ListDirOnlyName

func ListDirOnlyName(dirPth string, suffix string) (files []string, err error)

列出文件夹下文件名字

func MakeDir

func MakeDir(filedir string) error

根据传入文件夹名字递归新建文件夹 Create dir by recursion

func MakeDirByFile

func MakeDirByFile(filepath string) error

根据传入文件名,递归创建文件夹 ./dir/filename /home/dir/filename Create dir by the filename

func Md5

func Md5(str string) string

func Md5FS

func Md5FS(src io.Reader) string

对一个文件流进行hash计算

func ReadfromFile

func ReadfromFile(filepath string) ([]byte, error)

read bytes from file

func Rename

func Rename(oldfilename string, newfilename string) error

rename

func SI

func SI(s string) (i int, e error)

string to int

func SaveToFile

func SaveToFile(filepath string, content []byte) error

将字节数组保存到文件中去 Save bytes into file

func Second

func Second(times int) time.Duration

Get Secord

func SizeofDir

func SizeofDir(dirPth string) int

文件夹下数量

func Sleep

func Sleep(wait_time int)

func StringsToJson

func StringsToJson(str string) string

将字符串转成适合JSON格式的,比如中文转为\\u

func Strtomd5

func Strtomd5(s string) string

create md5 string

func Substr

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

func ToLower

func ToLower(s string) string

func TodayString

func TodayString(level int) string

func UrlD

func UrlD(s string) string

url解义

func UrlE

func UrlE(s string) string

url转义

func ValidBackFileName

func ValidBackFileName(filename string) string

func ValidFileName

func ValidFileName(filename string) string

去除标题中的非法字符 (Windows)

func WalkDir

func WalkDir(dirPth, suffix string) (files []string, err error)

递归列出文件夹下文件(全路径)

Types

This section is empty.

Directories

Path Synopsis
Package gomail provides a simple interface to compose emails and to mail them efficiently.
Package gomail provides a simple interface to compose emails and to mail them efficiently.
Open a file, directory, or URI using the OS's default application for that object type.
Open a file, directory, or URI using the OS's default application for that object type.

Jump to

Keyboard shortcuts

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