vtils

package
v0.0.0-...-ad5ef39 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func B2S

func B2S(b []byte) string

b2s converts byte slice to a string without memory allocation. See https://groups.google.com/forum/#!msg/Golang-Nuts/ENgbUzYvCuU/90yGx7GUAgAJ .

Note it may break if string and/or slice header will change in the future go versions.

func BytesToInt64

func BytesToInt64(buf []byte) int64

BytesToInt64 byte to int64

func DecodeBIG5

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

DecodeBIG5 convert BIG5 to UTF-8

func DecodeGBK

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

DecodeGBK convert GBK to UTF-8

func Delay

func Delay(i, j int64)

Delay 随机延迟睡眠处理

func DelayRand

func DelayRand(i, j int64) int64

DelayRand delay between seconds be set

func Detect

func Detect(b []byte) (*chardet.Result, error)

Detect detect charset

func EncodeBIG5

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

EncodeBIG5 convert UTF-8 to BIG5

func GetCurrentExecDir

func GetCurrentExecDir() (dir string, err error)

GetCurrentExecDir get exec dir

func GetCurrentPath

func GetCurrentPath() (string, error)

GetCurrentPath get current path of commend running

func GetFileSize

func GetFileSize(fullFilename string) int64

GetFileSize get file size

func GetOutboundIP

func GetOutboundIP() (net.IP, error)

GetOutboundIP Get preferred outbound ip of this machine

func Int32ToString

func Int32ToString(n int32) string

Int32ToString int32 to string

func Int64ToBytes

func Int64ToBytes(i int64) []byte

Int64ToBytes int64 to byte, use for timestamp

func LowercaseBytes

func LowercaseBytes(b []byte)

LowercaseBytes low

func RandString

func RandString(n int) string

func S2B

func S2B(s string) (b []byte)

s2b converts string to a byte slice without memory allocation.

Note it may break if string and/or slice header will change in the future go versions.

func SaveTOML

func SaveTOML(v interface{}, filename string) error

SaveTOML save interface to TOML file

func StrBuilder

func StrBuilder(args ...string) string

StrBuilder strings builder

func SubString

func SubString(str string, begin, length int) (substr string)

SubString sub string

func TomlDecode

func TomlDecode(data []byte, v interface{}) error

TomlDecode decode

func TomlEncode

func TomlEncode(v interface{}) ([]byte, error)

TomlEncode encode

func TransToUTF

func TransToUTF(input []byte) (output []byte, err error)

TransToUTF translate code to simplechinese

func WriteToFile

func WriteToFile(c []byte, filename string) error

WriteToFile write []byte to file

Types

This section is empty.

Jump to

Keyboard shortcuts

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