Documentation ¶
Overview ¶
Package slice contains utility functions to manage slices.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LongestString ¶ added in v0.8.2
LongestString returns the longest string in a slice of strings.
func Map ¶
func Map[K, V any](s []K, f func(K) V) []V
Map applies a function to each element of a slice and returns a new slice with the results.
func Merge ¶ added in v0.10.2
func Merge[K comparable](s1, s2 []K) []K
Merge merges two slices removing duplicates.
func Remove ¶ added in v0.10.2
func Remove[K comparable](slice []K, s K) []K
Remove returns a newly created slice that contains all items from slice that are not equal to s.
func Sub ¶ added in v0.10.2
func Sub[K comparable](s1, s2 []K) []K
Sub removes elements of s2 from s1.
func ToPointerSlice ¶
func ToPointerSlice[T any](s []T) []*T
ToPointerSlice returns a new slice of pointers to the elements of the input slice.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.