diff --git a/README.md b/README.md index 3f1da0b..b3c8a21 100644 --- a/README.md +++ b/README.md @@ -420,7 +420,7 @@ func Union(slices ...interface{}) interface{} //Union creates a slice of unique func UpdateByIndex(slice interface{}, index int, value interface{}) (interface{}, error) //update the slice element at index. func Without(slice interface{}, values ...interface{}) interface{} //creates a slice excluding all given values func GroupBy(slice, function interface{}) (interface{}, interface{}) // groups slice into two categories -Count[T any](slice []T, fn func(index int, t T) bool) int // Count iterates over elements of slice, returns a count of all matched elements +func Count[T any](slice []T, fn func(index int, t T) bool) int // Count iterates over elements of slice, returns a count of all matched elements ``` #### 10. strutil is for processing string diff --git a/README_zh-CN.md b/README_zh-CN.md index 14fd0c8..3038766 100644 --- a/README_zh-CN.md +++ b/README_zh-CN.md @@ -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 -Count[T any](slice []T, fn func(index int, t T) bool) int +func Count[T any](slice []T, fn func(index int, t T) bool) int //遍历slice的元素,返回所有匹配元素的计数 ``` #### 10. strutil字符串处理包