utils

package module
v0.0.0-...-cd0d1ff Latest Latest
Warning

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

Go to latest
Published: May 4, 2022 License: Apache-2.0 Imports: 19 Imported by: 8

README

Build Status GoDoc Go Report

utils

Golang Utils

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs32

func Abs32(x float32) float32

Abs32 Gives the absolute value of a float32

func Base64Dec

func Base64Dec(a string) ([]byte, error)

func Base64Enc

func Base64Enc(a []byte) string

func Base64FlateDec

func Base64FlateDec(a string) ([]byte, error)

func Base64TwoZlibDec

func Base64TwoZlibDec(v string) ([]byte, error)

func Base64TwoZlibEnc

func Base64TwoZlibEnc(a []byte) string

func Base64ZlibDec

func Base64ZlibDec(a string) ([]byte, error)

func Base64ZlibEnc

func Base64ZlibEnc(a []byte) string

func ChangeFileExt

func ChangeFileExt(s, ext string) string

ChangeFileExt changes the Extension value of a file FileName, returning the new value as a string.

func CommaTextToDynInt

func CommaTextToDynInt(a string) (b []int)

func DynIntToCommaText

func DynIntToCommaText(a []int) string

DynIntToCommaText return CommaText

func ExtractFileName

func ExtractFileName(s string) string

ExtractFileName extracts the file name substring.

func GB18030Dec

func GB18030Dec(r io.Reader) *transform.Reader

func GB18030DecStr

func GB18030DecStr(v string) (string, error)

func GB18030Enc

func GB18030Enc(r io.Reader) *transform.Reader

func GB18030EncStr

func GB18030EncStr(v string) string

func GB2312DecStr

func GB2312DecStr(v string) (string, error)

func GB2312EncStr

func GB2312EncStr(v string) string

func GBKDecStr

func GBKDecStr(v string) (string, error)

func GBKEncStr

func GBKEncStr(v string) string

func GbkDec

func GbkDec(r io.Reader) *transform.Reader

func GbkEnc

func GbkEnc(r io.Reader) *transform.Reader

func GetBool

func GetBool(v interface{}) bool

GetBool convert interface to bool.

func GetInt

func GetInt(v interface{}) int

GetInt convert interface to int.

func GetString

func GetString(v interface{}) string

GetString convert interface to string.

func HTMLDec

func HTMLDec(v string) (string, error)

func HTMLEnc

func HTMLEnc(v string) string

func HexDec

func HexDec(a string) ([]byte, error)

func HexEnc

func HexEnc(a []byte) string

func IfEmpty

func IfEmpty(a, b string) string

IfEmpty return first non-empty string

func IsDirectory

func IsDirectory(path string) (bool, error)

IsDirectory check file or directory

func IsExists

func IsExists(path string) (bool, error)

IsExists check file exist

func MaxInt

func MaxInt(x, y int) int

func MaxInt64

func MaxInt64(x, y int64) int64

func MinInt

func MinInt(x, y int) int

func MinInt64

func MinInt64(x, y int64) int64

func ParseTime

func ParseTime(v string) (time.Time, error)

ParseTime

func PrintJSON

func PrintJSON(v interface{})

func PrintJSONIndent

func PrintJSONIndent(v interface{})

func StrToFloat

func StrToFloat(s string) float64

func StrToFloat32

func StrToFloat32(s string) float32

StrToFloat32 Convert a float32 string into a float32 value

func StrToFloat32Def

func StrToFloat32Def(s string, def float32) float32

StrToFloat32Def Convert a string into an float32 value with default

func StrToInt

func StrToInt(s string) int

StrToInt Convert an int string into an int value

func StrToIntDef

func StrToIntDef(s string, def int) int

StrToIntDef Convert a string into an int value with default

func TimetampToTime

func TimetampToTime(v string) (time.Time, error)

TimetampToTime string Timetamp to Time

func ToGB18030Str

func ToGB18030Str(s string) ([]byte, error)

func ToGBKStr

func ToGBKStr(s string) ([]byte, error)

func URLDec

func URLDec(v string) (string, error)

func URLEnc

func URLEnc(v string) string

func UTF16DecStr

func UTF16DecStr(v string) (string, error)

func UTF16EncStr

func UTF16EncStr(v string) string

Types

type WideString

type WideString string

func (WideString) MarshalJSON

func (p WideString) MarshalJSON() ([]byte, error)

func (WideString) MarshalText

func (p WideString) MarshalText() ([]byte, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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