Documentation ¶
Overview ¶
Package bstr 包是用来处理字符串相关的操作
Index ¶
- func BuilderOrderNoRandSize(size uint, a ...string) string
- func IntToSha256(i int) string
- func RandInt(length uint) (n int)
- func RandLetter(length uint) string
- func RandNumber(length uint) string
- func Repr(v any) string
- func ShowLess(str string, opts ...int) string
- func StrMd5UnixNano() string
- func StrSha256UnixNano() string
- func StrToMd5(b string) string
- func StrToSha256(b string) string
- func StrUnixNanoNow() string
- func StrUnixNow() string
- func UUIDString() string
- type AnyType
- type LetterStruct
- type PlaceholderType
- type ResultLetter
- type Trie
- type TrieOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuilderOrderNoRandSize ¶
创建订单号, 指定随机数长度,其实改上面函数就行,为了兼容已经使用了的代码,再写个新的吧
func StrSha256UnixNano ¶
func StrSha256UnixNano() string
StrSha256UnixNano 使用 unix nano 时间戳生成 sha256 字符串, 长度 64
Types ¶
type LetterStruct ¶
type LetterStruct struct {
// contains filtered or unexported fields
}
LetterStruct Letter 结构
func (*LetterStruct) OnlyLetters ¶
func (ls *LetterStruct) OnlyLetters() *LetterStruct
OnlyLetters 设置生成随机数使用纯字母
func (*LetterStruct) OnlyNumber ¶
func (ls *LetterStruct) OnlyNumber() *LetterStruct
OnlyNumber 设置生成随机数使用纯数字
func (*LetterStruct) RandProcess ¶
func (ls *LetterStruct) RandProcess() ResultLetter
RandProcess 执行生成随机数的操作
func (*LetterStruct) SetLen ¶
func (ls *LetterStruct) SetLen(length uint) *LetterStruct
SetLen 设置生成随机字符串的长度
func (*LetterStruct) SetLetters ¶
func (ls *LetterStruct) SetLetters(letters string) *LetterStruct
SetLetters 设置生成随机数使用的字母
type PlaceholderType ¶
type PlaceholderType = struct{}
PlaceholderType represents a placeholder type.
var Placeholder PlaceholderType
Placeholder is a placeholder object that can be used globally.
type ResultLetter ¶
type ResultLetter string
ResultLetter 返回的数据类型
func (ResultLetter) ToLower ¶
func (rl ResultLetter) ToLower() string
ToLower 返回值转换成 string 类型, 并转转成小写
func (ResultLetter) ToUpper ¶
func (rl ResultLetter) ToUpper() string
ToUpper 返回值转换成 string 类型, 并转转成大写
type Trie ¶
type Trie interface { Filter(text string) (string, []string, bool) FindKeywords(text string) []string }
A Trie is a tree implementation that used to find elements rapidly.
func DefaultTrie ¶
func DefaultTrie() Trie
type TrieOption ¶
type TrieOption func(trie *trieNode)
TrieOption defines the method to customize a Trie.
func WithMask ¶
func WithMask(mask rune) TrieOption
WithMask customizes a Trie with keywords masked as given mask char.