Help us shape the future of Go! Take the 2026 Go Developer Survey

arrayutil

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAll

func AddAll(arrays ...interface{}) ([]interface{}, error)

AddAll 合并多个切片

func Clone

func Clone(arr interface{}) (interface{}, error)

Clone 克隆切片

func Contains

func Contains(arr interface{}, elem interface{}) (bool, error)

Contains 判断切片中是否包含元素

func Edit

func Edit(arr interface{}, editFunc func(interface{}) interface{}) (interface{}, error)

Edit 编辑切片中的元素

func Filter

func Filter(arr interface{}, filterFunc func(interface{}) bool) ([]interface{}, error)

Filter 过滤切片元素

func IsArray

func IsArray(arr interface{}) bool

IsArray 判断是否为数组或切片

func IsEmpty

func IsEmpty(arr interface{}) (bool, error)

IsEmpty 判断数组或切片是否为空

func IsNotEmpty

func IsNotEmpty(arr interface{}) (bool, error)

IsNotEmpty 判断数组或切片是否非空

func NewArray

func NewArray(elementType reflect.Type, size int) interface{}

NewArray 新建泛型数组

func Print

func Print(arr interface{}) error

Print 打印数组或切片的内容

func Range

func Range(start, end, step int) []int

Range 生成步进有序数组

func Resize

func Resize(arr interface{}, newSize int) (interface{}, error)

Resize 调整切片大小

func Split

func Split(data []byte, chunkSize int) [][]byte

Split 拆分字节切片

func ToString

func ToString(arr interface{}, sep string) (string, error)

ToString 将数组或切片转为字符串

func Unwrap

func Unwrap(arr []interface{}, elemType reflect.Type) (interface{}, error)

Unwrap 将泛型切片拆包为原始类型切片

func Wrap

func Wrap(arr interface{}) ([]interface{}, error)

Wrap 将原始类型切片包装成泛型切片

func Zip

func Zip(keys, values interface{}) (map[interface{}]interface{}, error)

Zip 将两个切片结合成键值对

Types

This section is empty.

Jump to

Keyboard shortcuts

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