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

feat: add DropRight and DropWhile

This commit is contained in:
dudaodong
2023-02-09 17:38:31 +08:00
parent afb021b4b5
commit 040e112aa6
3 changed files with 75 additions and 13 deletions

View File

@@ -482,7 +482,25 @@ func ExampleDrop() {
// Output:
// [a b c]
// [b c]
// [a b c]
// []
}
func ExampleDropRight() {
result1 := DropRight([]string{"a", "b", "c"}, 0)
result2 := DropRight([]string{"a", "b", "c"}, 1)
result3 := DropRight([]string{"a", "b", "c"}, -1)
result4 := DropRight([]string{"a", "b", "c"}, 4)
fmt.Println(result1)
fmt.Println(result2)
fmt.Println(result3)
fmt.Println(result4)
// Output:
// [a b c]
// [a b]
// [a b c]
// []
}