slice

package
v0.0.0-...-40008dc Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package slice contains methods for slice conversion and modification

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsInt

func ContainsInt(a int, list []int) bool

ContainsInt checks if an int is found in a slice of ints.

func ContainsString

func ContainsString(a string, list []string) bool

ContainsString checks if a string is found in a slice of strings.

func ConvertStringToFloat

func ConvertStringToFloat(slice []string) []float64

ConvertStringToFloat converts a slice of strings to a slice of float64.

func ConvertStringToInt

func ConvertStringToInt(slice []string) []int

ConvertStringToInt converts a slice of strings to a slice of ints.

func Dict

func Dict(slice []string) map[string]bool

Dict converts a slice into a dictionary/hash.

func DictInt

func DictInt(slice []int) map[int]bool

DictInt converts a slice into a dictionary/hash.

func Diff

func Diff(sliceA, sliceB []string) []string

Diff returns the different elements between two string slices

func HasIntersect

func HasIntersect(sliceA, sliceB []string) bool

HasIntersect determines if two string slices share any element.

func IndexOfString

func IndexOfString(str string, s []string) int

IndexOfString returns the index of a value in a slice.

func Intersect

func Intersect(sliceA, sliceB []string) []string

Intersect returns the shared elements between two string slices

func JoinInts

func JoinInts(intSlice []int, sep string) string

JoinInts joins a slice of ints to create a string.

func SomeFloat

func SomeFloat(slice []float64, f func(float64) bool) bool

SomeFloat evaluates a slice of floats []float64 and returns true if any member passes the provided function.

func SortStringsCaseInsensitive

func SortStringsCaseInsensitive(inputSlice []string) []string

SortStringsCaseInsensitive sorts a slice of strings ignoring case.

func UniqueInts

func UniqueInts(slice []int) []int

UniqueInts returns only the unique values in a slice of ints.

func UniqueStrings

func UniqueStrings(slice []string) []string

UniqueStrings returns only the unique values in a slice of strings.

Types

This section is empty.

Jump to

Keyboard shortcuts

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