array

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 5 Imported by: 0

README

Array library

Go Report Card codecov

Candidate functions :

Func Name Prototype Description Comments
Contains func Contain[T comparable](array []T, value T) bool {} Test if the value is in the array N/A
Find func Find[T comparable](array []T, value T) int {} Returns the index of the value in the array
(return -1 if the value isn't in the array)
N/A
IsEqual func IsEqual[T comparable](FirstArray, SecondArray []T) bool {} Test two array and check if they are equals N/A
Max func Max[T cmp.Ordered](array []T) (any, error) {} Returns the maximum value in the array N/A
Min func Min[T cmp.Ordered](array []T) (any, error) {} Returns the minimum value in the array N/A
Remove func Remove[T comparable](array []T, index int) []T {} Removes the value of the array at the index N/A
Slice func Slice[T comparable](array []T, start, end int) ([]T, error) {} Slices the array from start to end N/A
Sort func Sort[T cmp.Ordered](array []T, order int) {} Sorts the array in ascending or descending order N/A

Constants :

Name Type Value
ASC int 0
DESC int 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Variables = map[string]eclaType.Type{
	"ASC":  eclaType.Int(0),
	"DESC": eclaType.Int(1),
}

Functions

func Contains added in v1.0.1

func Contains[T comparable](array []T, value T) bool

Contains test if the value is in the array return True if inside and False if not inside

func Find

func Find[T comparable](array []T, value T) int

Find returns the index of the value in the array

func IsEqual

func IsEqual[T comparable](FirstArray, SecondArray []T) bool

IsEqual test two array and return true if same or false if different

func Max

func Max[T cmp.Ordered](array []T) (any, error)

Max returns the maximum value in the array

func Min

func Min[T cmp.Ordered](array []T) (any, error)

Min returns the minimum value in the array

func Remove

func Remove[T comparable](array []T, index int) []T

Remove the value at the index

func Slice

func Slice[T comparable](array []T, start, end int) ([]T, error)

Slice the array from start to end included

func Sort added in v1.0.1

func Sort[T cmp.Ordered](array []T, order int)

Sort sorts the array in ascending or descending order

Types

This section is empty.

Jump to

Keyboard shortcuts

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