1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-17 03:02:28 +08:00

Slice: CountV2 (#18)

Use generic instead of reflection
This commit is contained in:
donutloop
2022-01-09 15:15:03 +01:00
committed by GitHub
parent c4b4cb1173
commit 7b9a8a55e7
3 changed files with 14 additions and 15 deletions

View File

@@ -421,7 +421,7 @@ func Union(slices ...interface{}) interface{} //slice并集, 去重
func UpdateByIndex(slice interface{}, index int, value interface{}) (interface{}, error) //在切片中index位置更新value
func Without(slice interface{}, values ...interface{}) interface{} //slice去除values
func GroupBy(slice, function interface{}) (interface{}, interface{}) //根据函数function的逻辑分slice为两组slice
func Count(slice, function interface{}) int
Count[T any](slice []T, fn func(index int, t T) bool) int
```
#### 10. strutil字符串处理包