From e592a753bf83bb002cfd271f03e3a366bf83a145 Mon Sep 17 00:00:00 2001 From: xing Date: Mon, 24 Jun 2024 21:19:24 +0800 Subject: [PATCH] add some func --- helper/slice/slices.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/helper/slice/slices.go b/helper/slice/slices.go index f4cb2ab..58152e9 100644 --- a/helper/slice/slices.go +++ b/helper/slice/slices.go @@ -102,3 +102,9 @@ func DecompressBy[T, R any](a [][]T, fn func(T) (R, bool)) (r []R) { } return } + +func Replace[T any](a []T, offset int, replacement []T) { + aa := a[offset:] + aa = aa[:0] + aa = append(aa, replacement...) +}