Added DropByIndex helper for slice (#398)

* added DropByIndex helper

---------

Co-authored-by: Samuel Berthe <dev@samuel-berthe.fr>
This commit is contained in:
Owen Gong
2024-06-30 06:38:34 +08:00
committed by GitHub
parent 93686db8b5
commit 52e17faeec
5 changed files with 95 additions and 0 deletions

View File

@@ -296,6 +296,15 @@ func ExampleDropRightWhile() {
// Output: [0 1 2]
}
func ExampleDropByIndex() {
list := []int{0, 1, 2, 3, 4, 5}
result := DropByIndex(list, 2)
fmt.Printf("%v", result)
// Output: [0 1 3 4 5]
}
func ExampleReject() {
list := []int{0, 1, 2, 3, 4, 5}