21
0
Fork 0

v0.0.425 ArrAppend
Build Docker and Deploy / Run goext test-suite (push) Successful in 2m25s Details

This commit is contained in:
Mike Schwörer 2024-03-30 14:24:53 +01:00
parent 9491b72b8d
commit 36b71dfaf3
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
2 changed files with 11 additions and 2 deletions

View File

@ -1,5 +1,5 @@
package goext
const GoextVersion = "0.0.424"
const GoextVersion = "0.0.425"
const GoextVersionTimestamp = "2024-03-30T03:01:55+0100"
const GoextVersionTimestamp = "2024-03-30T14:24:53+0100"

View File

@ -453,6 +453,15 @@ func ArrConcat[T any](arr ...[]T) []T {
return r
}
// ArrAppend works similar to append(x, y, z) - but doe snot touch the old array and creates a new one
func ArrAppend[T any](arr []T, add ...T) []T {
r := ArrCopy(arr)
for _, v := range add {
r = append(r, v)
}
return r
}
// ArrCopy does a shallow copy of the 'in' array
func ArrCopy[T any](in []T) []T {
out := make([]T, len(in))