array

package
v0.11.6 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chunk added in v0.11.6

func Chunk(j []int, size int) [][]int

Chunk 将一个切片分割成多个子切片 i := []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9} size := 3 output: [[0 1 2] [3 4 5] [6 7 8] [9]]

func Int64ToStringWithDecimals

func Int64ToStringWithDecimals(num int64, digit int) string

Int64ToStringWithDecimals 将 int64 转换为包含小数点后指定位数的字符串

func InterfaceArrayDiffSet

func InterfaceArrayDiffSet(a, b interface{}) interface{}

InterfaceArrayDiffSet 计算两个任意类型数组的差集,返回一个新数组包含只在一个数组中出现的元素 *

  • @Description: 获取两个切片差集
  • @param a
  • @param b
  • @return []string

func InterfaceArrayUnion

func InterfaceArrayUnion(arr1, arr2 interface{}) interface{}

InterfaceArrayUnion 计算多种类型数组的并集,返回一个新的数组包含所有元素,不包含重复元素

func IsExistRepeatInInterfaceArray

func IsExistRepeatInInterfaceArray(array []interface{}) (exist bool)

IsExistRepeatInInterfaceArray 检查 Interface 数组中是否存在重复对象 *

  • @Description: Interface 数组中是否存在重复对象
  • @param array
  • @return exist

func IsInterfaceArrayExistElement

func IsInterfaceArrayExistElement(array []interface{}, element interface{}) (exist bool)

IsInterfaceArrayExistElement 检查 Interface 数组中是否包含某个元素 *

  • @Description: Interface 数组中是否包含某个元素
  • @param array
  • @param element
  • @return exist

func RemoveDuplicatesInInterfaceSlice

func RemoveDuplicatesInInterfaceSlice(numbers []interface{}) []interface{}

RemoveDuplicatesInInterfaceSlice 移除掉重复值

func RemoveEmptyInterfaceInArray

func RemoveEmptyInterfaceInArray(array []interface{}) []interface{}

RemoveEmptyInterfaceInArray 移除空的对象 *

  • @Description: 移除空的对象
  • @param array
  • @return answer

func RemoveZeroInInterfaceSlice

func RemoveZeroInInterfaceSlice(arr []interface{}) []interface{}

RemoveZeroInInterfaceSlice 移除掉0的值

Types

This section is empty.

Jump to

Keyboard shortcuts

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