ints

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Between added in v0.4.1

func Between(val, min, max int) bool

Between returns true if val is between min and max.

func Contains added in v0.4.2

func Contains(arr []int, val int) bool

Contains returns true if val is in arr.

func InArray

func InArray(val int, arr []int) bool

InArray returns true if val is in arr.

func Itoa

func Itoa(i int) string

Itoa converts an int to a string.

func Max added in v0.4.1

func Max(v ...int) int

Max returns the maximum of ints.

func Min added in v0.4.1

func Min(v ...int) int

Min returns the minimum of ints.

func Random

func Random(min, max int) int

Random returns a random int between min and max.

func RandomString

func RandomString(length int) string

RandomString returns a random string of length.

func Range

func Range(min, max int) []int

Range returns an array of ints between min and max.

func Sort added in v0.4.2

func Sort(slice []int) []int

Sort alias for SortAsc.

func SortAsc added in v0.4.2

func SortAsc(slice []int) []int

SortAsc sorts a slice of ints in ascending order.

func SortDesc added in v0.4.2

func SortDesc(slice []int) []int

SortDesc sorts a slice of ints in descending order.

func Split

func Split(s, sep string) []int

Split splits a string into an array of ints.

func Sum added in v0.4.1

func Sum(v ...int) int

Sum returns the sum of ints.

func SumSlice added in v0.4.2

func SumSlice(v []int) int

SumSlice returns the sum of a slice of ints.

Types

type Counter added in v0.5.0

type Counter struct {
	// contains filtered or unexported fields
}

func (*Counter) Dec added in v0.5.0

func (c *Counter) Dec(n int)

func (*Counter) Inc added in v0.5.0

func (c *Counter) Inc(n int)

func (*Counter) Val added in v0.5.0

func (c *Counter) Val() int

type Int

type Int int

func (Int) Between added in v0.4.1

func (i Int) Between(min, max int) bool

Between returns true if the int is between min and max.

func (Int) Bytes

func (i Int) Bytes() []byte

Bytes returns the bytes of the string.

func (Int) InArray

func (i Int) InArray(arr []int) bool

InArray returns true if the int is in the array.

func (Int) Itoa

func (i Int) Itoa() string

Itoa converts an int to a string.

func (Int) String

func (i Int) String() string

String alias for Itoa.

func (Int) Val

func (i Int) Val() int

Val returns the int value.

Jump to

Keyboard shortcuts

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