Documentation ¶
Overview ¶
切片转字符串相关
Index ¶
- func Contains[T comparable](source []T, target T) bool
- func Filter[SourceType any](source []SourceType, filter func(s SourceType) bool) []SourceType
- func GroupBy[K comparable, V any, T []V](keyFunc func(V) K, source T) map[K]T
- func Insert[T any](source []T, element T, index int) []T
- func Join[T any](source []T, sep string) string
- func Map[SourceType, ReturnType any](source []SourceType, mapFunc func(SourceType) ReturnType) []ReturnType
- func New[T any]() []T
- func Reduce[T comparable, Source any](initVal T, reducer func(val T, v Source) T, source []Source) T
- func SliceExclude[T comparable](source, exclude []T) []T
- func ToStrSlice[T any](s []T) []string
- func Unique[T comparable](source []T) []T
- type Slice
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Contains ¶
func Contains[T comparable](source []T, target T) bool
func GroupBy ¶ added in v0.1.20
func GroupBy[K comparable, V any, T []V](keyFunc func(V) K, source T) map[K]T
GroupBy 将slice按照key分组
func Map ¶ added in v0.1.24
func Map[SourceType, ReturnType any](source []SourceType, mapFunc func(SourceType) ReturnType) []ReturnType
func Reduce ¶ added in v0.1.58
func Reduce[T comparable, Source any](initVal T, reducer func(val T, v Source) T, source []Source) T
func SliceExclude ¶
func SliceExclude[T comparable](source, exclude []T) []T
func ToStrSlice ¶
func Unique ¶
func Unique[T comparable](source []T) []T
Types ¶
Click to show internal directories.
Click to hide internal directories.