Documentation ¶
Index ¶
- func Column[S any, I any](s []S, fn func(key int, val S) I) []I
- func Contain[V any](m []V, value V) bool
- func Copy[T any](s []T) []T
- func CopyAndForEachWithReturn[T any](s []T, f func(key int, val T) T) []T
- func CopyAndForWithPointer[T any](s []T, f func(key int, val *T) bool) []T
- func FilterStringEmpty(s []string) []string
- func Float64Reverse(s []float64)
- func IntReverse(s []int)
- func Prefix(s []string, prefix string) []string
- func Search[V any](m []V, value V) (int, bool)
- func StringReverse(s []string)
- func ToMap[K comparable, V any](s []V, fn func(key int, val V) K) map[K]V
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Contain ¶
Contain 判断切片是否包含值(泛型) Contain[V any](m []V, value V) bool @param m []V 泛型切片 @param value V 泛型值 @return bool 是否存在
func Copy ¶
func Copy[T any](s []T) []T
Copy 深拷贝泛型切片 Copy[T any](s []T) []T @param s []T 泛型切片 @return []T 深拷贝的泛型切片
func CopyAndForEachWithReturn ¶
CopyAndForEachWithReturn 拷贝并遍历泛型切片(通过返回值修改值) ForEach[T any](s []T, f func(key int, val T) T) []T @param s []T 泛型切片 @param f func(key int, val T) T func(索引, 值) 修改值 @return []T 遍历后的泛型切片
func CopyAndForWithPointer ¶
CopyAndForWithPointer 拷贝并遍历泛型切片(通过指针传递修改值) For[T any](s []T, f func(key int, val *T) bool) []T @param s []T 泛型切片 @param f func(key int, val *T) bool func(索引, 值) 是否继续遍历 @return []T 遍历后的泛型切片
func FilterStringEmpty ¶
func Float64Reverse ¶
func Float64Reverse(s []float64)
func IntReverse ¶
func IntReverse(s []int)
func Prefix ¶
Prefix 给字符串切片加上前缀 Prefix(s []string, prefix string) []string @param s []string 字符串切片 @param prefix string 前缀 @return []string 结果字符串切片
func Search ¶
Search 判断切片是否包含值,并返回值对应索引(泛型) Search[V any](m []V, value V) (int, bool) @param m []V 泛型切片 @param value V 泛型值 @return int 值对应的索引,不存在则为-1 @return bool 是否存在
func StringReverse ¶
func StringReverse(s []string)
func ToMap ¶
func ToMap[K comparable, V any](s []V, fn func(key int, val V) K) map[K]V
Types ¶
This section is empty.