helper

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package from https://github.com/gogf/gf

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CutLastString

func CutLastString(text, beginChar, endChar string) string

CutLastString 截取字符串中最后一段,以@beginChar开始,@endChar结束的字符 @text 文本 @beginChar 开始

func EllipseTruncate

func EllipseTruncate(s string, max int) string

func GoRecover

func GoRecover(f func(), name string)

GoRecover take a function as input, if the function panics, the panic will be recovered and the error will be returned

func IsBlank

func IsBlank(value string) bool

func IsEmpty

func IsEmpty(value any) bool

IsEmpty checks whether given <value> empty. It returns true if <value> is in: 0, nil, false, "", len(slice/map/chan) == 0, or else it returns false.

func IsLetter

func IsLetter(b byte) bool

IsLetter checks whether the given byte b is a letter.

func IsLetterLower

func IsLetterLower(b byte) bool

IsLetterLower checks whether the given byte b is in lower case.

func IsLetterUpper

func IsLetterUpper(b byte) bool

IsLetterUpper checks whether the given byte b is in upper case.

func IsNil

func IsNil(value any, traceSource ...bool) bool

IsNil checks whether given <value> is nil. Parameter <traceSource> is used for tracing to the source variable if given <value> is type of a pinter that also points to a pointer. It returns nil if the source is nil when <traceSource> is true. Note that it might use reflect feature which affects performance a little bit.

func IsNotBlank

func IsNotBlank(value string) bool

func IsNumeric

func IsNumeric(s string) bool

IsNumeric checks whether the given string s is numeric. Note that float string like "123.456" is also numeric.

func Min

func Min[T constraints.Ordered](a, b T) T

func RunWithRetry

func RunWithRetry(runFunc func(idx int) (retry bool, err error), maxCnt int) error

RunWithRetry

func SafeGo

func SafeGo(fn func())

SafeGo go with recover

func SplitIndex

func SplitIndex(s, sep string, index int) (string, bool)

func ToInt

func ToInt(value string, def ...int) (int, bool)

func ToInt32

func ToInt32(value string, def ...int32) (int32, bool)

func ToInt32D

func ToInt32D(value string, def ...int32) int32

func ToInt64

func ToInt64(value string, def ...int64) (int64, bool)

func ToInt64D

func ToInt64D(value string, def ...int64) int64

func ToIntD

func ToIntD(value string, def ...int) int

func ToString

func ToString(value any) string

func ToStringSlice

func ToStringSlice(val []any) []string

func ToUint

func ToUint(value string, def ...uint) (uint, bool)

func ToUintD

func ToUintD(value string, def ...uint) uint

func Try

func Try(tryFn func(), catchFn func(errString string)) bool

func UcFirst

func UcFirst(s string) string

UcFirst returns a copy of the string s with the first letter mapped to its upper case.

func WaitForSignal

func WaitForSignal()

Types

This section is empty.

Jump to

Keyboard shortcuts

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