slicex

package
v0.1.78 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

切片转字符串相关

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains[T comparable](source []T, target T) bool

func Filter added in v0.1.54

func Filter[SourceType any](source []SourceType, filter func(s SourceType) bool) []SourceType

func GroupBy added in v0.1.20

func GroupBy[K comparable, V any, T []V](keyFunc func(V) K, source T) map[K]T

GroupBy 将slice按照key分组

func Insert added in v0.1.56

func Insert[T any](source []T, element T, index int) []T

func Join

func Join[T any](source []T, sep string) string

func Map added in v0.1.24

func Map[SourceType, ReturnType any](source []SourceType, mapFunc func(SourceType) ReturnType) []ReturnType

func New

func New[T any]() []T

func Reduce added in v0.1.58

func Reduce[T comparable, Source any](initVal T, reducer func(val T, v Source) T, source []Source) T

func SliceExclude

func SliceExclude[T comparable](source, exclude []T) []T

func ToStrSlice

func ToStrSlice[T any](s []T) []string

func Unique

func Unique[T comparable](source []T) []T

Types

type Slice

type Slice[T any, ReturnType any] []T

func (Slice[T, ReturnType]) Map

func (s Slice[T, ReturnType]) Map(mapFunc func(T) ReturnType) []ReturnType

Jump to

Keyboard shortcuts

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