slice

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains[T any](slice []T, predicate func(T) bool) bool

func ContainsString

func ContainsString(slice []string, s string) bool

ContainsString checks if a given slice of strings contains the provided string.

func Filter

func Filter[T any](slice []T, predicate func(T) bool) []T

func Find

func Find[T any](slice []T, predicate func(T) bool) (element T, ok bool)

Find checks if an element in slice satisfies the given predicate, and returns it. If no element is found returns false

func Map

func Map[T, R any](slice []T, f func(T) R) []R

func MapErr

func MapErr[T, R any](slice []T, f func(T) (R, error)) ([]R, error)

func RemoveString

func RemoveString(slice []string, s string) []string

RemoveString returns a newly created []string that contains all items from slice that are not equal to s.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL