stl

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2023 License: MulanPSL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BestMatchMap added in v0.2.2

func BestMatchMap[K comparable, V any](m map[K]V, pattern K, threshold float32, f func(K, K) float32) (V, bool)

func CountSlice added in v0.2.1

func CountSlice[T comparable](s []T, v T) int

func IndexSlice added in v0.2.1

func IndexSlice[T comparable](s []T, v T, begin int) int

func InsertList

func InsertList[S ~[]E, E any](s S, pos int, i ...E) S

insert in Array, Slice, or String

func MatchMap added in v0.2.3

func MatchMap[V any](m map[string]V, pattern string, f func(string, V) error) error

通配符匹配map

func MatchMapReg added in v0.2.3

func MatchMapReg[V any](m map[string]V, reg *regexp.Regexp, f func(string, V) error) error

func MatchMapWildcard added in v0.2.3

func MatchMapWildcard[V any](m map[string]V, pattern string, f func(string, V) error) error

'*' - matches zero or more characters '?' - matches one character

func MatchMapWith added in v0.2.3

func MatchMapWith[T comparable, V any](m map[T]V, match func(T) bool, f func(T, V) error) error

func MergeMap

func MergeMap[T comparable, V any](l map[T]V, r map[T]V, update bool) map[T]V

func SliceHas added in v0.2.3

func SliceHas[T comparable](s []T, v T) bool

func SliceMatchWith added in v0.2.3

func SliceMatchWith[T any](s []T, match func(T) bool) []T

func SliceResize added in v0.2.2

func SliceResize[T any](s []T, size int) []T

func SliceReverse added in v0.2.4

func SliceReverse[T any](s []T) []T

func StringSliceMatch added in v0.2.3

func StringSliceMatch(s []string, pattern string) []string

func StringSliceMatchReg added in v0.2.3

func StringSliceMatchReg(s []string, reg *regexp.Regexp) []string

func StringSliceMatchWildcard added in v0.2.3

func StringSliceMatchWildcard(s []string, pattern string) []string

Types

type Lesser added in v0.2.1

type Lesser[T any] interface {
	Less(r T) bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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