inarray

package
v1.1.34 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2022 License: MIT Imports: 0 Imported by: 1

README

InArray

Simple utilty functions that check for the presence of a given element in a given slice, and returns of the found element. -1 is used to denote no match.

arr := []int{1, 2, 3}
inarray.Ints(2, arr) // 1
inarray.Ints(4, arr) // -1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Floats

func Floats(needle float64, haystack []float64) int

Floats returns the position of needle in the haystack if found, -1 otherwise.

func Ints

func Ints(needle int, haystack []int) int

Ints returns the position of needle in the haystack if found, -1 otherwise.

func Strings

func Strings(needle string, haystack []string) int

Strings returns the position of needle in the haystack if found, -1 otherwise.

Types

This section is empty.

Jump to

Keyboard shortcuts

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