bzslice

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Column

func Column[S any, I any](s []S, fn func(key int, val S) I) []I

func Contain

func Contain[V any](m []V, value V) bool

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

func CopyAndForEachWithReturn[T any](s []T, f func(key int, val T) T) []T

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

func CopyAndForWithPointer[T any](s []T, f func(key int, val *T) bool) []T

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 FilterStringEmpty(s []string) []string

func Float64Reverse

func Float64Reverse(s []float64)

func IntReverse

func IntReverse(s []int)

func Prefix

func Prefix(s []string, prefix string) []string

Prefix 给字符串切片加上前缀 Prefix(s []string, prefix string) []string @param s []string 字符串切片 @param prefix string 前缀 @return []string 结果字符串切片

func Search[V any](m []V, value V) (int, bool)

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.

Jump to

Keyboard shortcuts

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