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

Slice: Add GroupBy func (#10)

Group by: split slice into two groups, applies on each slice element a
predicate func to categorize this element.

Changes

* Add groub by func
* Add test case for this func
This commit is contained in:
donutloop
2022-01-02 14:24:56 +01:00
committed by GitHub
parent 94b1a1d383
commit b4a49fccfd
4 changed files with 52 additions and 0 deletions

View File

@@ -413,6 +413,7 @@ func Unique(slice interface{}) interface{} //去重切片
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{})
```
#### 10. strutil字符串处理包