algoutils

package
v0.0.0-...-77a3b3b Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

func All(vs []string, f func(string) bool) bool

All returns true if all of the strings in the slice satisfy the predicate f. Example: fmt.Println(All(strs, func(v string) bool { return strings.HasPrefix(v, "p") }))

func Any

func Any(vs []string, f func(string) bool) bool

Any returns true if one of the strings in the slice satisfies the predicate f. Example: fmt.Println(Any(strs, func(v string) bool { return strings.HasPrefix(v, "p") }))

func Filter

func Filter(vs []string, f func(string) bool) []string

Filter returns a new slice containing all strings in the slice that satisfy the predicate f. Example: fmt.Println(Filter(strs, func(v string) bool { return strings.Contains(v, "e") }))

func GetDigitAndCharCount

func GetDigitAndCharCount(str string, val ...rune) int

GetDigitAndCharCount returns the count of char and digits

func GetDigitsCount

func GetDigitsCount(str string) int

GetDigitsCount counts the number of digits in the string

func GetHash32

func GetHash32(strslice []string) uint32

GetHash32 return the hash for a stringslice

func Map

func Map(vs []string, f func(string) string) []string

Map returns a new slice containing the results of applying the function f to each string in the original slice. Example: fmt.Println(Map(strs, strings.ToUpper))

func Max

func Max(x, y int) int

Max returns the maximum of two ints

func MaxIntSlice

func MaxIntSlice(v []int) (m int)

MaxIntSlice returns the maximum from an int slice

func MaxIntVarible

func MaxIntVarible(v1 int, vn ...int) (m int)

MaxIntVarible returns the maximum from variadic arguments

func Min

func Min(x, y int) int

Min returns the minimum of two variables

func MinInt64

func MinInt64(x, y int64) int64

MinInt64 return the minimum of two Int64

func MinIntSlice

func MinIntSlice(v []int) (m int)

MinIntSlice returns the minimum from int slice. Zero is returned if slice is empty

func MinIntVarible

func MinIntVarible(v1 int, vn ...int) (m int)

MinIntVarible returns the minimum from variadic arguments

func Slice

func Slice(args ...interface{}) []interface{}

Slice returns a slice out of variadic arguments

func SortedKeysString

func SortedKeysString(m map[string]interface{}, reverse bool) []string

SortedKeysString returns sorted string keys

func StringContainsAll

func StringContainsAll(line string, patterns []string) bool

StringContainsAll returns true when all the patterns are present in the string 'line'

Types

This section is empty.

Jump to

Keyboard shortcuts

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