Discover Packages
github.com/btm6084/utilities
inarray
package
Version:
v1.1.44
Opens a new window with list of versions in this module.
Published: Dec 6, 2022
License: MIT
Opens a new window with license information.
Imports: 0
Opens a new window with list of imports.
Imported by: 1
Opens a new window with list of known importers.
README Documentation Source Files InArray Index Constants Variables Functions Types Floats(needle, haystack) Ints(needle, haystack) Strings(needle, haystack)
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
Expand ▾
Collapse ▴
Documentation
¶
Floats returns the position of needle in the haystack if found, -1 otherwise.
Ints returns the position of needle in the haystack if found, -1 otherwise.
Strings returns the position of needle in the haystack if found, -1 otherwise.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.