Documentation ¶
Index ¶
- func IntContains(array []int, val int) (index int)
- func IntIn(val int, array []int) bool
- func IsEmptyStringsArray(array []string) bool
- func RemoveDuplicateElementInt(sourceArray []int) []int
- func RemoveDuplicateElementString(sourceArray []string) []string
- func RemoveDuplicateElementUint(sourceArray []uint) []uint
- func RemoveElementInt(sourceArray *[]int, toBeRemoved int) (removed bool)
- func RemoveElementUint(sourceArray *[]uint, toBeRemoved uint) (removed bool)
- func RemoveElementsInt(sourceArray *[]int, toBeRemoved *[]int) (newArray []int)
- func SplitStringArrayTo(stringArray *[]string, length int) (splitArray [][]string, groups int)
- func StringArrayToIntArray(strArray []string) (intArray []int)
- func StringsContains(array []string, val string) (index int)
- func UintIn(val uint, array []uint) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IntContains ¶
func IsEmptyStringsArray ¶
func RemoveDuplicateElementInt ¶
给[]int 去重。 该函数总共初始化两个变量,一个长度为0的slice,一个空map。由于slice传参是按引用传递,没有创建额外的变量。 只是用了一个for循环,代码更简洁易懂。 利用了map的多返回值特性。 空struct不占内存空间,可谓巧妙。
func RemoveDuplicateElementString ¶
给[]string去重,原理同上
func RemoveDuplicateElementUint ¶
给[]uin去重,原理同上
func RemoveElementInt ¶
删除Array中的某个int(如果该array中有多个相同的元素,每次只能删除1个)
func RemoveElementUint ¶
删除Array中的某个uint(如果该array中有多个相同的元素,每次只能删除1个)
func RemoveElementsInt ¶
如果sourceArray中有 toBeRemoved array中的元素,则从sourceArray中删除,最终返回新的array https://stackoverflow.com/questions/5020958/go-what-is-the-fastest-cleanest-way-to-remove-multiple-entries-from-a-slice/5022696
func SplitStringArrayTo ¶
将一个string array 分成最大数量 length个的若干个string array,分成了groups组 当stringArray为空array时,groups == 0
func StringArrayToIntArray ¶
将字符串list转换为int list,如果字符串list中的某元素不可转换为int,则 int list中不会有此项。
func StringsContains ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.