my

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2019 License: BSD-2-Clause Imports: 16 Imported by: 3

README

my

Build Status Go Report Card GoDoc

my utility package

Install

go get -u github.com/zs5460/my

License

Licensed under The BSD-2-Clause License

Documentation

Overview

Package my provides some useful utility functions

Index

Constants

This section is empty.

Variables

View Source
var (
	// RequestTimeout ...
	RequestTimeout time.Duration = 10
)

Functions

func AppendText

func AppendText(filepath string, text string) (err error)

AppendText ...

func CDate

func CDate(s string) (ret time.Time)

CDate returns the result of time.ParseInLocation.

func CInt

func CInt(s string) (ret int)

CInt returns the result of strconv.Atoi.

func CStr

func CStr(i int) string

CStr returns the result of strconv.Itoa.

func FriendlyTime

func FriendlyTime(t time.Time) string

FriendlyTime ...

func GetURL

func GetURL(url string) (reply []byte, err error)

GetURL ...

func HMACSHA1

func HMACSHA1(s string, key string) (ret string)

HMACSHA1 generate a keyed hash value using the HMAC method.

func IsEmpty

func IsEmpty(s string) bool

IsEmpty ...

func IsExist

func IsExist(path string) bool

IsExist checks whether a file or directory exists.

func Left

func Left(s string, n int) (ret string)

Left returns a specified number of characters from the left side of a string.

func Len

func Len(s string) int

Len returns the number of rune in a string.

func MD5

func MD5(s string) (ret string)

MD5 calculate the md5 hash of a string.

func Mid

func Mid(s string, start, length int) (ret string)

Mid returns a specified number of characters from a string.

func Now

func Now() string

Now returns the current date and time.

func PostURL

func PostURL(url string, params string) (reply []byte, err error)

PostURL ... params is a string like k1=v1&k2=v2

func ReadText

func ReadText(filepath string) (text string, err error)

ReadText ...

func Right(s string, n int) (ret string)

Right returns a specified number of characters from the right side of a string.

func RndAlpha

func RndAlpha(n int) string

RndAlpha ...

func RndFilename

func RndFilename(ext string) string

RndFilename ...

func RndNumber

func RndNumber(n int) string

RndNumber ...

func RndString

func RndString(n int) string

RndString ...

func SHA1

func SHA1(s string) (ret string)

SHA1 calculate the sha1 hash of a string.

func SHA256

func SHA256(s string) (ret string)

SHA256 calculate the sha256 hash of a string.

func Space

func Space(count int) string

Space returns a string consisting of the specified number of spaces.

func Test

func Test(str, pattern string) (ret bool)

Test provides some common regular expression detection features.

func WriteText

func WriteText(filepath string, text string) (err error)

WriteText ...

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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