Insert List at Index
Insert the values of another list at the index of the working list.
Examples
Filter
package main
import (
"fmt"
)
func main() {
s := []int{1, 2, 3, 4, 5}
s2 := []int{6, 7, 8, 9, 10}
insertIdx := 3
s = append(s[:insertIdx], append(s2, s[insertIdx:]...)...)
fmt.Println(s)
}
Last Run
:
[1 2 3 6 7 8 9 10 4 5]