Documentation ¶
Index ¶
- Variables
- func Contains(list []string, str string) bool
- func Filter(s string, filter func(r rune) bool) string
- func FirstN(s string, n int, ellipsis ...string) string
- func HasEmpty(args ...string) bool
- func NotEmpty(args ...string) bool
- func Rand() string
- func RandId() string
- func Randn(n int) string
- func Remove(strings []string, strs ...string) []string
- func Reverse(s string) string
- func Seed(seed int64)
- func Substr(str string, start, stop int) (string, error)
- func TakeOne(valid, or string) string
- func TakeWithPriority(fns ...func() string) string
- func Union(first, second []string) []string
- type Replacer
- type Trie
- type TrieOption
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidStartPosition is an error that indicates the start position is invalid. ErrInvalidStartPosition = errors.New("start position is invalid") // ErrInvalidStopPosition is an error that indicates the stop position is invalid. ErrInvalidStopPosition = errors.New("stop position is invalid") )
Functions ¶
func Substr ¶
Substr returns runes between start and stop [start, stop) regardless of the chars are ascii or utf8.
func TakeWithPriority ¶
TakeWithPriority returns the first not empty result from fns.
Types ¶
type Replacer ¶
Replacer interface wraps the Replace method.
func NewReplacer ¶
NewReplacer returns a Replacer.
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.
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.
Click to show internal directories.
Click to hide internal directories.