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

add playground demo

This commit is contained in:
dudaodong
2024-02-01 10:41:09 +08:00
parent 6d4fc981b6
commit fa298b740d
8 changed files with 21 additions and 18 deletions

View File

@@ -619,7 +619,7 @@ func IntSlice(slice any) []int {
}
// DeleteAt delete the element of slice at index.
// Play: https://go.dev/play/p/pJ-d6MUWcvK
// Play: https://go.dev/play/p/800B1dPBYyd
func DeleteAt[T any](slice []T, index int) []T {
if index >= len(slice) {
index = len(slice) - 1
@@ -633,7 +633,7 @@ func DeleteAt[T any](slice []T, index int) []T {
}
// DeleteRange delete the element of slice from start index to end indexexclude).
// Play: todo
// Play: https://go.dev/play/p/945HwiNrnle
func DeleteRange[T any](slice []T, start, end int) []T {
result := make([]T, 0, len(slice)-(end-start))