Documentation
¶
Overview ¶
Package slicex provides generic functional utilities for slices.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Filter ¶
Filter returns a new slice containing only the elements of items for which pred returns true.
func SplitAndTrim ¶
SplitAndTrim splits input by sep, trims leading and trailing whitespace from each substring, and returns a slice of non-empty substrings. Returns nil if input is empty.
func Unique ¶
func Unique[T comparable](items []T) []T
Unique returns a new slice containing only unique elements from items, preserving the order of first appearance.
func UniqueBy ¶
func UniqueBy[T any, K comparable](items []T, keyFn func(T) K) []T
UniqueBy returns a new slice containing only the elements of items with unique keys determined by keyFn, preserving the order of first appearance.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.