Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Lookup ¶
Example ¶
package main import ( "go.llib.dev/testcase/internal/slicekit" ) func main() { vs := []int{2, 4, 8, 16} slicekit.Lookup(vs, 0) // -> return 2, true slicekit.Lookup(vs, 0-1) // lookup previous -> return 0, false slicekit.Lookup(vs, 0+1) // lookup next -> return 4, true slicekit.Lookup(vs, 0+1000) // lookup 1000th element -> return 0, false }
func Merge ¶
func Merge[T any](slices ...[]T) []T
Merge will merge every []T slice into a single one.
Example ¶
package main import ( "go.llib.dev/testcase/internal/slicekit" ) func main() { var ( a = []string{"a", "b", "c"} b = []string{"1", "2", "3"} c = []string{"1", "B", "3"} out = slicekit.Merge(a, b, c) ) _ = out // []string{"a", "b", "c", "1", "2", "3", "1", "B", "3"} }
func ReverseLookup ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.