arrutil

package
v0.3.12 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2021 License: MIT Imports: 4 Imported by: 60

Documentation

Overview

Package arrutil provides some util functions for array, slice

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains added in v0.3.6

func Contains(arr, val interface{}) bool

Contains assert array(strings, intXs, uintXs) should be contains the given value(int(X),string).

func GetRandomOne added in v0.3.8

func GetRandomOne(arr interface{}) interface{}

GetRandomOne get random element from an array/slice

func Int64sHas added in v0.3.6

func Int64sHas(ints []int64, val int64) bool

Int64sHas check the []int64 contains the given value

func IntsHas added in v0.3.6

func IntsHas(ints []int, val int) bool

IntsHas check the []int contains the given value

func NotContains added in v0.3.6

func NotContains(arr, val interface{}) bool

NotContains array(strings, ints, uints) should be not contains the given value.

func Reverse

func Reverse(ss []string)

Reverse string slice [site user info 0] -> [0 info user site]

func StringsHas added in v0.3.6

func StringsHas(ss []string, val string) bool

StringsHas check the []string contains the given element

func StringsRemove added in v0.1.4

func StringsRemove(ss []string, s string) []string

StringsRemove an value form an string slice

func StringsToInts added in v0.2.2

func StringsToInts(ss []string) (ints []int, err error)

StringsToInts string slice to int slice

func TrimStrings added in v0.2.2

func TrimStrings(ss []string, cutSet ...string) (ns []string)

TrimStrings trim string slice item.

Types

type Ints added in v0.3.9

type Ints []int

Ints type

func (Ints) Has added in v0.3.9

func (is Ints) Has(i int) bool

Has given element

func (Ints) String added in v0.3.9

func (is Ints) String() string

String to string

type Strings added in v0.3.9

type Strings []string

Strings type

func (Strings) Has added in v0.3.9

func (ss Strings) Has(sub string) bool

Has given element

func (Strings) String added in v0.3.9

func (ss Strings) String() string

String to string

Jump to

Keyboard shortcuts

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