Documentation ¶
Index ¶
- func BytesToRunes(b []byte) []rune
- func Filter[T any](s []T, f func(T) bool) []T
- func Includes[T comparable](slice []T, value T) bool
- func IsPtr(v any) bool
- func Keys[K comparable, V any](m map[K]V) []K
- func Merge[T any](slices ...[]T) (mergedSlice []T)
- func RemoveZWNBS[T string | []byte](input T) T
- func RunesToBytes(runes []rune) []byte
- func Sort[T constraints.Ordered](s []T)
- func SplitAfter(str string, sep []rune, min int) ([]string, error)
- func Sum[K comparable, V constraints.Float | constraints.Integer](m map[K]V) V
- type Set
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesToRunes ¶ added in v0.1.14
func Filter ¶
Filter filters values from a slice using a filter function. It returns a new slice with only the elements of s for which f returned true.
func Includes ¶
func Includes[T comparable](slice []T, value T) bool
Includes - given a slice of type T and a value of type T, determines whether the value is contained by the slice.
func Keys ¶
func Keys[K comparable, V any](m map[K]V) []K
Keys returns the keys of the map m in a slice. The keys will be returned in an unpredictable order. This function has two type parameters, K and V. Map keys must be comparable, so key has the predeclared constraint comparable. Map values can be any type.
func Merge ¶
func Merge[T any](slices ...[]T) (mergedSlice []T)
Merge - receives slices of type T and merges them into a single slice of type T.
func RemoveZWNBS ¶ added in v0.1.16
func RunesToBytes ¶ added in v0.1.14
func Sort ¶
func Sort[T constraints.Ordered](s []T)
Sort - sorts given a slice of any order-able type T The constraints.Ordered constraint in the Sort() function guarantees that the function can sort values of any type supporting the operators <, <=, >=, >.
func SplitAfter ¶ added in v0.1.4
func Sum ¶
func Sum[K comparable, V constraints.Float | constraints.Integer](m map[K]V) V
Sum sums the values of map containing numeric or float values
Types ¶
type Set ¶
type Set[T comparable] map[T]struct{}
Set is a set of any values.
func MakeSet ¶ added in v0.1.4
func MakeSet[T comparable]() Set[T]
MakeSet returns a set of some element type.
func (Set[T]) Add ¶
func (s Set[T]) Add(v T)
Add adds v to the set s. If v is already in s this has no effect.