Documentation
¶
Overview ¶
Package from https://github.com/gogf/gf
Index ¶
- func CutLastString(text, beginChar, endChar string) string
- func DeleteFile(filepath string) error
- func EllipseTruncate(s string, max int) string
- func GenerateRandomString(n int) (string, error)
- func GetFile(filepath string) (*os.File, error)
- func GoRecover(f func(), name string)
- func IsBlank(value string) bool
- func IsEmpty(value any) bool
- func IsLetter(b byte) bool
- func IsLetterLower(b byte) bool
- func IsLetterUpper(b byte) bool
- func IsNil(value any, traceSource ...bool) bool
- func IsNotBlank(value string) bool
- func IsNumeric(s string) bool
- func KebabToCamel(str string) string
- func Min[T constraints.Ordered](a, b T) T
- func PascalToCamel(s string) string
- func PascalToSnake(s string) string
- func ReadDir(dir string) []string
- func Round(val float64, n int) float64
- func RunWithRetry(runFunc func(idx int) (retry bool, err error), maxCnt int) error
- func SafeGo(fn func())
- func SanitizeURI(u string) string
- func SnakeToPascal(s string) string
- func SplitIndex(s, sep string, index int) (string, bool)
- func ToInt(value string, def ...int) (int, bool)
- func ToInt32(value string, def ...int32) (int32, bool)
- func ToInt32D(value string, def ...int32) int32
- func ToInt64(value string, def ...int64) (int64, bool)
- func ToInt64D(value string, def ...int64) int64
- func ToIntD(value string, def ...int) int
- func ToString(value any) string
- func ToStringSlice(val []any) []string
- func ToUint(value string, def ...uint) (uint, bool)
- func ToUintD(value string, def ...uint) uint
- func Try(tryFn func(), catchFn func(errString string)) bool
- func UcFirst(s string) string
- func WaitForSignal()
- func WriteFile(filepath string, b []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CutLastString ¶
CutLastString 截取字符串中最后一段,以@beginChar开始,@endChar结束的字符 @text 文本 @beginChar 开始
func DeleteFile ¶ added in v1.1.2
DeleteFile will delete filepath permanently. Returns an error in case there's any.
func EllipseTruncate ¶
func GenerateRandomString ¶ added in v1.1.2
GenerateRandomString generates a cryptographically random, alphanumeric string of length n.
func GetFile ¶ added in v1.1.2
GetFile will open filepath. Returns a tuple with a file and an error in case there's any.
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 IsEmpty ¶
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 IsLetterLower ¶
IsLetterLower checks whether the given byte b is in lower case.
func IsLetterUpper ¶
IsLetterUpper checks whether the given byte b is in upper case.
func IsNil ¶
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 IsNumeric ¶
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 ¶
RunWithRetry
func SanitizeURI ¶ added in v1.1.2
SanitizeURI takes a URL or URI, removes the domain from it, returns only the URI. This is used for cleaning "next" redirect URLs/URIs to prevent open redirects.
func ToStringSlice ¶
func UcFirst ¶
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.