utils

package
v1.9.3 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(obj interface{}, target interface{}) bool

func ContainsStr

func ContainsStr(slice []string, item string) bool

func CopyFile

func CopyFile(src, dst string) bool

CopyFile 拷贝文件

func CopyPath

func CopyPath(src, dst string) bool

CopyPath 拷贝目录

func CreateDir

func CreateDir(string2 string) error

func DirDot

func DirDot() string

func ExecShell

func ExecShell(shell string, dir string) (stdout string, stderr string)

ExecShell 执行shell命令

func Explode

func Explode(delimiter, datastr string) (arr []string)

Explode 将字符串按字符拆成数组

func FileExists

func FileExists(path string) (bool, error)

func GetCurrentDirectory

func GetCurrentDirectory() string

func GetFileInfo

func GetFileInfo(src string) os.FileInfo

GetFileInfo 获取文件信息

func GetRandStr

func GetRandStr(n int) (randStr string)

func IFF

func IFF[T any](yes bool, a, b T) T

IFF if yes return a else b

func IFN

func IFN[T any](yes bool, a, b func() T) T

IFN if yes return func, a() else b().

func LowercaseFirst

func LowercaseFirst(str string) string

func Md5String

func Md5String(str string) string

func Md5ToLower

func Md5ToLower(str string) string

Md5ToLower md5大写

func Md5ToUpper

func Md5ToUpper(str string) string

Md5ToUpper md5小写

func MergeMap

func MergeMap(source map[string][]string, tagret map[string][]string)

func NewLine

func NewLine() string

func PadLeft

func PadLeft(s string, pad string, plength int) string

func PathExists

func PathExists(path string) (bool, error)

func RemoveFile

func RemoveFile(filePath string) error

func Substr

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

Substr字符串截取

func Try added in v1.9.3

func Try(userFn func(), catchFn func(err interface{}))

Try 捕捉异常

func UppercaseFirst

func UppercaseFirst(str string) string

func WriteFile

func WriteFile(filePath string, content string) error

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