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:
@@ -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]
|
||||
// []
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user