sliceutil

package
v0.0.0-...-df633b8 Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsInInt32Slice

func ContainsInInt32Slice(s []int32, e int32) bool

func ContainsInIntSlice

func ContainsInIntSlice(s []int, e int) bool

func ContainsInStringSlice

func ContainsInStringSlice(s []string, e string) bool

func ContainsInStringSliceIgnoreCase

func ContainsInStringSliceIgnoreCase(s []string, e string) bool

func GetComplementaryAndIntersection

func GetComplementaryAndIntersection(oldIds []int, newIds []int) (needToDeleteIds, needToCreateIds, needToUpdateIds []int)

GetComplementaryAndIntersection 取 oldIds 不在 newIds 的id,取 newIds 不在 oldIds 的id,取交集

func IndexOfStringSlice

func IndexOfStringSlice(s []string, e string) int

IndexOfStringSlice returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.

func IntersectionIntSlice

func IntersectionIntSlice(i1 []int, i2 []int) []int

IntersectionIntSlice 用于获取两个 Int 类型切片的交集

func RemoveDuplicateFromIntSlice

func RemoveDuplicateFromIntSlice(s []int) []int

RemoveDuplicateFromIntSlice removes duplicate elements of the integer slice. 去重

func RemoveDuplicateFromStringSlice

func RemoveDuplicateFromStringSlice(s []string) []string

RemoveDuplicateFromStringSlice removes duplicate elements of the string slice.

func RemoveFromStringSlice

func RemoveFromStringSlice(s []string, e string) []string

RemoveFromStringSlice removes the first occurrence of the specified element from this list, if it is present. If the list does not contain the element, it is unchanged.

func RemoveValueFromIntSlice

func RemoveValueFromIntSlice(a []int, rmVal int) []int

删除 int 类型切片中的元素

func SplitIntoChunk

func SplitIntoChunk[T any](items []T, chunkSize int) (chunks [][]T)

SplitIntoChunk 会将 items 切片切割成块,每一块的大小上限是 chunkSize

Types

This section is empty.

Jump to

Keyboard shortcuts

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