Documentation ¶
Index ¶
- Variables
- func BTS(b []byte) string
- func BytesToString(b []byte) string
- func Camel2Snake(s string) string
- func Contains(list []string, str string) bool
- func Filter(s string, filter func(r rune) bool) string
- func FuncFullName(fnc any) string
- func FuncName(fnc any) string
- func HasEmpty(args ...string) bool
- func NotEmpty(args ...string) bool
- func Ptr[T any](x T) *T
- func RelevantCaller(outsidePkg string) runtime.Frame
- func Remove(strings []string, strs ...string) []string
- func Reverse(s string) string
- func Round32(f float32, n int) float32
- func Round64(f float64, n int) float64
- func STB(s string) (b []byte)
- func StringToBytes(s string) []byte
- func Substr(str string, start int, stop int) (string, error)
- func TakeOne(valid, or string) string
- func TakeWithPriority(fns ...func() string) string
- func ToBool(v any) (b bool, err error)
- func ToBytes(stream any) (data []byte)
- func ToDuration(v any) (dr time.Duration, err error)
- func ToFloat32(v any) (f32 float32, err error)
- func ToFloat64(v any) (f64 float64, err error)
- func ToInt(v any) (i int, err error)
- func ToInt16(v any) (i16 int16, err error)
- func ToInt32(v any) (i32 int32, err error)
- func ToInt64(v any) (i64 int64, err error)
- func ToInt8(v any) (i8 int8, err error)
- func ToString(v any) (s string)
- func ToString2(v any) (s string, err error)
- func ToTime(layout string, v any) (tm *time.Time, err error)
- func ToUint(v any) (ui uint, err error)
- func ToUint16(v any) (ui16 uint16, err error)
- func ToUint32(v any) (ui32 uint32, err error)
- func ToUint64(v any) (ui64 uint64, err error)
- func ToUint8(v any) (ui8 uint8, err error)
- func Union(first, second []string) []string
- type PlaceholderType
- type Replacer
- type Trie
- type TrieOption
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidStartPosition = errors.New("start position is invalid") ErrInvalidStopPosition = errors.New("stop position is invalid") )
Functions ¶
func BytesToString ¶
BytesToString converts byte slice to string without a memory allocation.
func Camel2Snake ¶
func FuncFullName ¶ added in v0.4.3
func RelevantCaller ¶
relevantCaller searches the call stack for the first function outside of pkg The purpose of this function is to provide more helpful error messages. how to use? example: caller := relevantCaller("net/http.") logx.Info("superfluous WriteHeader call from %s (%s:%d)", caller.Function, path.Base(caller.File), caller.Line)
func StringToBytes ¶
StringToBytes converts string to byte slice without a memory allocation.
func Substr ¶
Substr returns runes between start and stop [start, stop) regardless of the chars are ascii or utf8
func TakeWithPriority ¶
func ToString ¶
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Types ¶
type Replacer ¶
func NewReplacer ¶
type Trie ¶
type Trie interface { Filter(text string) (string, []string, bool) FindKeywords(text string) []string }
func NewTrie ¶
func NewTrie(words []string, opts ...TrieOption) Trie
type TrieOption ¶
type TrieOption func(trie *trieNode)
func WithMask ¶
func WithMask(mask rune) TrieOption