arrutil

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Column added in v1.0.2

func Column[T, V any](arr []T, fn func(item T) V) (result []V)

Column 返回数组对象中的int类型的列组成的数组

func ColumnMap added in v1.0.2

func ColumnMap[K comparable, V, T any](arr []T, fn func(item T) (K, V)) (result map[K]V)

ColumnMap 返回数组对象属性值映射的map

func ColumnUnique added in v1.0.2

func ColumnUnique[T any, V comparable](arr []T, fn func(item T) V) (result []V)

ColumnUnique 返回数组对象中的int类型的列组成的数组并去重

func InArray

func InArray[T comparable](v T, arr []T) bool

InArray 判断数据是否在数组中

func Intersect

func Intersect[T comparable](arr1, arr2 []T) []T

Intersect 两个数组取交集

func Max added in v1.0.2

func Max[T constraints.Ordered](arr []T) (ret T)

Max 数组取最大值

func Merge

func Merge[T any](arr1, arr2 []T) []T

Merge 合并两个数组

func Min added in v1.0.2

func Min[T constraints.Ordered](arr []T) (ret T)

Min 数组取最小值

func NumbersToStrs

func NumbersToStrs[T constraints.Integer | constraints.Float](arr []T) []string

NumbersToStrs 任意类型slice转为字符串数组

func Reverse

func Reverse[T any](arr []T) []T

Reverse 反转数组

func Split

func Split[T any](arr []T, n int) (ret [][]T)

Split 将数组分为n份

func Unique

func Unique[T comparable](arr []T) []T

Unique 去重

Types

This section is empty.

Jump to

Keyboard shortcuts

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