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 Join(sep byte, elem ...string) string
- 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 ToCamelCase(s string) string
- func Union(first, second []string) []string
- type Replacer
- type Trie
- type TrieOption
Constants ¶
This section is empty.
Variables ¶
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 Join ¶
Join joins any number of elements into a single string, separating them with given sep. Empty elements are ignored. However, if the argument list is empty or all its elements are empty, Join returns an empty string.
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.
func ToCamelCase ¶
ToCamelCase returns the string that converts the first letter to lowercase.
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.