feat: add ReduceRight

This commit is contained in:
dudaodong committed 2023-04-04 17:54:54 +08:00
1 parent f198191063
commit c01c9d14b4
5 files changed
+95 -3

No files matched your search

+11
View File
@@ -477,6 +477,17 @@ func ExampleReduceBy() {
// 1234
}
func ExampleReduceRight() {
result := ReduceRight([]int{1, 2, 3, 4}, "", func(_ int, item int, agg string) string {
return agg + fmt.Sprintf("%v", item)
})
fmt.Println(result)
// Output:
// 4321
}
func ExampleReplace() {
strs := []string{"a", "b", "c", "a"}