stringx

package
v1.1.2-0...-f7e2eea Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 31, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidStartPosition = errors.New("start position is invalid")
	ErrInvalidStopPosition  = errors.New("stop position is invalid")
)

Functions

func Contains

func Contains(list []string, str string) bool

func Filter

func Filter(s string, filter func(r rune) bool) string

func HasEmpty

func HasEmpty(args ...string) bool

func NotEmpty

func NotEmpty(args ...string) bool

func Rand

func Rand() string

func RandId

func RandId() string

func Randn

func Randn(n int) string

func Remove

func Remove(strings []string, strs ...string) []string

func Reverse

func Reverse(s string) string

func Seed

func Seed(seed int64)

func Substr

func Substr(str string, start int, stop int) (string, error)

Substr returns runes between start and stop [start, stop) regardless of the chars are ascii or utf8

func TakeOne

func TakeOne(valid, or string) string

func TakeWithPriority

func TakeWithPriority(fns ...func() string) string

func Union

func Union(first, second []string) []string

Types

type Replacer

type Replacer interface {
	Replace(text string) string
}

func NewReplacer

func NewReplacer(mapping map[string]string) Replacer

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL