Help us shape the future of Go! Take the 2026 Go Developer Survey

collection

package module
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: Apache-2.0 Imports: 0 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

func All(vs []string, f func(string) bool) bool

All returns true if all the strings in the slice satisfy the predicate f

func Any

func Any(vs []string, f func(string) bool) bool

Any returns true if one of the strings in the slice satisfies the predicate f

func Dedup added in v0.1.4

func Dedup[T comparable](in []T) (out []T)

Dedup returns the input slice after removing duplicated items

func Distinct added in v0.1.2

func Distinct(vs []string) []string

Distinct remove the duplicated items from the slice

func Equal added in v0.1.3

func Equal(s1 []string, s2 []string) bool

Equal checks whether 2 slices have the same items

func Filter

func Filter(vs []string, f func(string) bool) []string

Filter returns a new slice containing all strings in the slice that satisfy the predicate f

func Include

func Include(vs []string, t string) bool

Include returns true if the target string t is in the slice.

func Index

func Index(vs []string, t string) int

Index returns the first index of the target string t, or -1 if no match is found

func Map

func Map(vs []string, f func(string) string) []string

Map returns a new slice containing the results of applying the function f to each string in the original slice

func MapI added in v0.1.1

func MapI(vs []string, f func(string) interface{}) []interface{}

MapI returns a new slice containing the results of applying the function f to each string in the original slice

Types

This section is empty.

Jump to

Keyboard shortcuts

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