util

package
v0.0.0-...-b909ee8 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs(number int) int

func Abs64

func Abs64(number int64) int64

func AddIndex

func AddIndex[T comparable](index int, value T, slice []T) []T

func Any

func Any[T comparable](slice []T, predicate func(T) bool) bool

func Chunks

func Chunks[T any](slice []T, size int) [][]T

func Concat

func Concat(a, b int) int

func DeepCopySlice

func DeepCopySlice[T any](slice []T) []T

func Digits

func Digits(num int) int

func Digits64

func Digits64(num int64) int

func DivMod

func DivMod(numerator, denominator int) (quotient, remainder int)

func Every

func Every[T comparable](slice []T, predicate func(T) bool) bool

func Fill

func Fill[T any](item T, length int) []T

func Filter

func Filter[T any](slice []T, filter func(T) bool) []T

func FirstOrDefault

func FirstOrDefault[T any](slice []T, predicate func(T) bool) T

func Flat

func Flat[T any](slice [][]T) []T

func GCD

func GCD(a, b int) int

func IterToSlice

func IterToSlice[T any](iter iter.Seq[T]) []T

func KeyByValue

func KeyByValue[K comparable, V comparable](m map[K]V, value V) K

func LCM

func LCM(a, b int, ints ...int) int

func LastElement

func LastElement[T comparable](slice []T) T

func Lines

func Lines(text string) []string

func MakeRange

func MakeRange(min, max int) []int

func MatchAllNamedSubgroups

func MatchAllNamedSubgroups(exp *regexp.Regexp, input string) []map[string]string

func MatchNamedSubgroups

func MatchNamedSubgroups(exp *regexp.Regexp, input string) map[string]string

func Matrix

func Matrix(text string, colSeparator string) [][]string

func MinInt

func MinInt(a, b int) int

func MinInt64

func MinInt64(a, b int64) int64

func MustParseInt

func MustParseInt(input string) int

func MustParseInt64

func MustParseInt64(text string) int64

func PadNumber

func PadNumber(nr int) string

func Remove

func Remove[T comparable](slice []T, elemToRemove T) []T

func RemoveIndex

func RemoveIndex[T comparable](index int, slice []T) []T

func SortedKeys

func SortedKeys[K cmp.Ordered, V any](m map[K]V, desc bool) []K

func SumInts

func SumInts(items []int) int

func ToIntSlice

func ToIntSlice(slice []string) []int

func Transpose

func Transpose[T any](matrix [][]T) [][]T

Types

This section is empty.

Jump to

Keyboard shortcuts

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