sliceutil

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainByInt

func ContainByInt(arr []int, element int) bool

判断数组中是否包含指定元素

func Filter

func Filter[T any](slice []T, f func(T) bool) []T

func Find

func Find[T any](slice []T, f func(T) bool) (*T, error)

func Int16ToInt

func Int16ToInt(o []int16) []int

func Int16ToInt32

func Int16ToInt32(o []int16) []int32

func Int16ToInt64

func Int16ToInt64(o []int16) []int64

func Int16ToInt8

func Int16ToInt8(o []int16) []int8

func Int16ToUint

func Int16ToUint(o []int16) []uint

func Int32ToInt

func Int32ToInt(o []int32) []int

func Int32ToInt16

func Int32ToInt16(o []int32) []int16

func Int32ToInt64

func Int32ToInt64(o []int32) []int64

func Int32ToInt8

func Int32ToInt8(o []int32) []int8

func Int32ToUint

func Int32ToUint(o []int32) []uint

func Int64ToInt

func Int64ToInt(o []int64) []int

func Int64ToInt16

func Int64ToInt16(o []int64) []int16

func Int64ToInt32

func Int64ToInt32(o []int64) []int32

func Int64ToInt8

func Int64ToInt8(o []int64) []int8

func Int8ToInt

func Int8ToInt(o []int8) []int

func Int8ToInt16

func Int8ToInt16(o []int8) []int16

func Int8ToInt32

func Int8ToInt32(o []int8) []int32

func Int8ToInt64

func Int8ToInt64(o []int8) []int64

func Int8ToUint

func Int8ToUint(o []int8) []uint

func IntToInt16

func IntToInt16(o []int) []int16

func IntToInt32

func IntToInt32(o []int) []int32

func IntToInt64

func IntToInt64(o []int) []int64

func IntToInt8

func IntToInt8(o []int) []int8

func IntToUint

func IntToUint(o []int) []uint

func IsSliceOrArray

func IsSliceOrArray(x interface{}) bool

判断是否是切片或者数组

func MoveElementToEndAndRemovePrevious

func MoveElementToEndAndRemovePrevious[T any](arr []T, elementIndex int) ([]T, error)

从数组中移除指定元素之前的全部元素,并将该元素放到数组末尾

例如:数组[1,2,3,4,5],移除元素3,结果为[4,5,1,2,3]

参数:

  • arr: 需要修改的数组
  • elementIndex: 需要移除的元素的索引

Types

This section is empty.

Jump to

Keyboard shortcuts

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