zint16s

package
v0.10.15 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInterfaceNotInt16 = errors.New("encountered non-int16 interface")
)

Functions

func As

func As(slice []interface{}) (res []int16, err error)

Convert a []interface{} slice into []int16 slice if possible

func Contains

func Contains(haystack []int16, needle int16) bool

Check if a slice ([]int16) contains a matching member

func ContainsAll

func ContainsAll(haystack []int16, needles ...int16) bool

Check if a []int16 slice contains ALL of the provided members

func ContainsAny

func ContainsAny(haystack []int16, needles ...int16) bool

Check if a []int16 slice contains ANY of the provided members

func Cut

func Cut(slice []int16, separator int16) (left, right []int16, found bool)

Cut the slice into two slices separated by the separator

func CutAny

func CutAny(val []int16, seperators ...int16) (left, right []int16, found bool)

Cut the slice into two slices separated by the first separator

func CutAt added in v0.9.1

func CutAt(val []int16, index int) (left, right []int16)

Cut the slice at the specified index

func Equal

func Equal(a []int16, b []int16) bool

Determine if two slices are equal to each other

func Fill added in v0.7.3

func Fill(slice []int16, val int16) []int16

Fill a slice with the given value

func Index

func Index(haystack []int16, needle int16) int

Find the index where the needle appears. Returns -1 if the needle doesn't appear in the slice.

func Interface

func Interface(slice []int16) (res []interface{}, err error)

Convert a []int16 slice into a slice of interfaces ([]interface{})

func Remove added in v0.5.10

func Remove(slice []int16, offset int, values ...int16) (res []int16)

Remove the first occurrence of each value from the slice starting from the supplied offset

func RemoveAt added in v0.5.10

func RemoveAt(slice []int16, index int) (res []int16)

Remove the item at the index while preserving the order of the items TODO: maybe change this to take multiple indices and to remove them at the same time

func Resize added in v0.5.8

func Resize(s []int16, n int) (res []int16)

Resize a slice to the given length

func Sort added in v0.5.6

func Sort(s []int16)

Sort the slice in ascending order

func SortReverse added in v0.5.7

func SortReverse(s []int16)

Sort the slice in descending order

func Split

func Split(slice []int16, separator int16) (parts [][]int16)

Split the slice into one or more slices separated by the separator

Types

This section is empty.

Jump to

Keyboard shortcuts

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