Documentation
¶
Overview ¶
Package sliceutil 提供对数组和切片的相关功能
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Count ¶
Count 检测数组中指定值的数量
slice 需要检测的数组或是切片,其它类型会 panic; eq 对比函数,i 表示数组的下标,需要在函数将该下标表示的值与你需要的值进行比较是否相等;
Example ¶
intSlice := []int{1, 2, 3, 7, 0, 4, 7} fmt.Println(Count(intSlice, func(i int) bool { return intSlice[i] == 7 }))
Output: 2
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.