slice

package
v0.0.0-...-d31700d Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendIfNo

func AppendIfNo(slice interface{}, targets ...interface{}) interface{}

AppendIfNo append value in targets to slice if slice has no this value.

Example
Output:

[{3 c} {0 } {2 b} {0 } {9 f}]
[{3 c} {0 } {2 b} {0 } {9 f}]
[{3 c} {0 } {2 b} {0 } {9 f} {4 d}]

func AppendIfNoBool

func AppendIfNoBool(slice []bool, targets ...bool) []bool
Example
Output:

[true]
[true false]
[true true false]

func AppendIfNoInt

func AppendIfNoInt(slice []int, targets ...int) []int
Example
Output:

[1]
[1 2]
[1 2 3]

func AppendIfNoInt16

func AppendIfNoInt16(slice []int16, targets ...int16) []int16
Example
Output:

[1]
[1 2]
[1 2 3]

func AppendIfNoInt32

func AppendIfNoInt32(slice []int32, targets ...int32) []int32
Example
Output:

[1]
[1 2]
[1 2 3]

func AppendIfNoInt64

func AppendIfNoInt64(slice []int64, targets ...int64) []int64
Example
Output:

[1]
[1 2]
[1 2 3]

func AppendIfNoInt8

func AppendIfNoInt8(slice []int8, targets ...int8) []int8
Example
Output:

[1]
[1 2]
[1 2 3]

func AppendIfNoInterface

func AppendIfNoInterface(slice []interface{}, targets ...interface{}) []interface{}
Example
Output:

[3 c false 2 b]
[3 c false 2 b]
[3 c false 2 b 4 d]

func AppendIfNoString

func AppendIfNoString(slice []string, targets ...string) []string
Example
Output:

[a]
[a b]
[a b c]

func AppendIfNoUint

func AppendIfNoUint(slice []uint, targets ...uint) []uint
Example
Output:

[1]
[1 2]
[1 2 3]

func AppendIfNoUint16

func AppendIfNoUint16(slice []uint16, targets ...uint16) []uint16
Example
Output:

[1]
[1 2]
[1 2 3]

func AppendIfNoUint32

func AppendIfNoUint32(slice []uint32, targets ...uint32) []uint32
Example
Output:

[1]
[1 2]
[1 2 3]

func AppendIfNoUint64

func AppendIfNoUint64(slice []uint64, targets ...uint64) []uint64
Example
Output:

[1]
[1 2]
[1 2 3]

func AppendIfNoUint8

func AppendIfNoUint8(slice []uint8, targets ...uint8) []uint8
Example
Output:

[1]
[1 2]
[1 2 3]

func AppendIfNoValue

func AppendIfNoValue(slice reflect.Value, targets ...interface{}) reflect.Value
Example
Output:

[{3 c} {0 } {2 b} {0 } {9 f}]
[{3 c} {0 } {2 b} {0 } {9 f}]
[{3 c} {0 } {2 b} {0 } {9 f} {4 d}]

func Contains

func Contains(length int, fun func(int) bool) bool
Example
Output:

false
true
true
false

func ContainsAllBool

func ContainsAllBool(slice []bool, targets ...bool) bool
Example
Output:

true
true
true
false
false

func ContainsAllGeneric

func ContainsAllGeneric(slice interface{}, targets ...interface{}) bool
Example
Output:

true
false
true
false
true
true
true
false
false

func ContainsAllInt

func ContainsAllInt(slice []int, targets ...int) bool
Example
Output:

true
true
true
false
false

func ContainsAllInt16

func ContainsAllInt16(slice []int16, targets ...int16) bool
Example
Output:

true
true
true
false
false

func ContainsAllInt32

func ContainsAllInt32(slice []int32, targets ...int32) bool
Example
Output:

true
true
true
false
false

func ContainsAllInt64

func ContainsAllInt64(slice []int64, targets ...int64) bool
Example
Output:

true
true
true
false
false

func ContainsAllInt8

func ContainsAllInt8(slice []int8, targets ...int8) bool
Example
Output:

true
true
true
false
false

func ContainsAllInterface

func ContainsAllInterface(slice []interface{}, targets ...interface{}) bool
Example
Output:

true
false

func ContainsAllString

func ContainsAllString(slice []string, targets ...string) bool
Example
Output:

true
true
true
false
false

func ContainsAllUint

func ContainsAllUint(slice []uint, targets ...uint) bool
Example
Output:

true
true
true
false
false

func ContainsAllUint16

func ContainsAllUint16(slice []uint16, targets ...uint16) bool
Example
Output:

true
true
true
false
false

func ContainsAllUint32

func ContainsAllUint32(slice []uint32, targets ...uint32) bool
Example
Output:

true
true
true
false
false

func ContainsAllUint64

func ContainsAllUint64(slice []uint64, targets ...uint64) bool
Example
Output:

true
true
true
false
false

func ContainsAllUint8

func ContainsAllUint8(slice []uint8, targets ...uint8) bool
Example
Output:

true
true
true
false
false

func ContainsAllValue

func ContainsAllValue(slice reflect.Value, targets ...interface{}) bool
Example
Output:

true
false
false

func ContainsAnyBool

func ContainsAnyBool(slice []bool, targets ...bool) bool
Example
Output:

false
false
false
false
true

func ContainsAnyGeneric

func ContainsAnyGeneric(slice interface{}, targets ...interface{}) bool
Example
Output:

false
false
false
false
false
true
true
true
false

func ContainsAnyInt

func ContainsAnyInt(slice []int, targets ...int) bool
Example
Output:

false
false
false
true
false

func ContainsAnyInt16

func ContainsAnyInt16(slice []int16, targets ...int16) bool
Example
Output:

false
false
false
true
false

func ContainsAnyInt32

func ContainsAnyInt32(slice []int32, targets ...int32) bool
Example
Output:

false
false
false
true
false

func ContainsAnyInt64

func ContainsAnyInt64(slice []int64, targets ...int64) bool
Example
Output:

false
false
false
true
false

func ContainsAnyInt8

func ContainsAnyInt8(slice []int8, targets ...int8) bool
Example
Output:

false
false
false
true
false

func ContainsAnyInterface

func ContainsAnyInterface(slice []interface{}, targets ...interface{}) bool
Example
Output:

false
true
true
false

func ContainsAnyString

func ContainsAnyString(slice []string, targets ...string) bool
Example
Output:

false
false
false
false
true

func ContainsAnyUint

func ContainsAnyUint(slice []uint, targets ...uint) bool
Example
Output:

false
false
false
true
false

func ContainsAnyUint16

func ContainsAnyUint16(slice []uint16, targets ...uint16) bool
Example
Output:

false
false
false
true
false

func ContainsAnyUint32

func ContainsAnyUint32(slice []uint32, targets ...uint32) bool
Example
Output:

false
false
false
true
false

func ContainsAnyUint64

func ContainsAnyUint64(slice []uint64, targets ...uint64) bool
Example
Output:

false
false
false
true
false

func ContainsAnyUint8

func ContainsAnyUint8(slice []uint8, targets ...uint8) bool
Example
Output:

false
false
false
true
false

func ContainsAnyValue

func ContainsAnyValue(slice reflect.Value, targets ...interface{}) bool
Example
Output:

false
true
true
false

func ContainsBool

func ContainsBool(slice []bool, target bool) bool
Example
Output:

true
true
false

func ContainsGeneric

func ContainsGeneric(slice interface{}, target interface{}) bool
Example
Output:

false
true
true
false
false

func ContainsInt

func ContainsInt(slice []int, target int) bool
Example
Output:

true
false

func ContainsInt16

func ContainsInt16(slice []int16, target int16) bool
Example
Output:

true
false

func ContainsInt32

func ContainsInt32(slice []int32, target int32) bool
Example
Output:

true
false

func ContainsInt64

func ContainsInt64(slice []int64, target int64) bool
Example
Output:

true
false

func ContainsInt8

func ContainsInt8(slice []int8, target int8) bool
Example
Output:

true
false

func ContainsInterface

func ContainsInterface(slice []interface{}, target interface{}) bool
Example
Output:

true
false

func ContainsString

func ContainsString(slice []string, target string) bool
Example
Output:

true
false

func ContainsUint

func ContainsUint(slice []uint, target uint) bool
Example
Output:

true
false

func ContainsUint16

func ContainsUint16(slice []uint16, target uint16) bool
Example
Output:

true
false

func ContainsUint32

func ContainsUint32(slice []uint32, target uint32) bool
Example
Output:

true
false

func ContainsUint64

func ContainsUint64(slice []uint64, target uint64) bool
Example
Output:

true
false

func ContainsUint8

func ContainsUint8(slice []uint8, target uint8) bool
Example
Output:

true
false

func ContainsValue

func ContainsValue(slice reflect.Value, target interface{}) bool
Example
Output:

true
false
false

func Index

func Index(length int, fun func(int) bool) int
Example
Output:

-1
-1
2

func IndexBool

func IndexBool(slice []bool, target bool) int
Example
Output:

-1
0
1

func IndexGeneric

func IndexGeneric(slice interface{}, target interface{}) int
Example
Output:

-1
-1
-1
-1
2

func IndexInt

func IndexInt(slice []int, target int) int
Example
Output:

-1
-1
0
2

func IndexInt16

func IndexInt16(slice []int16, target int16) int
Example
Output:

-1
-1
0
2

func IndexInt32

func IndexInt32(slice []int32, target int32) int
Example
Output:

-1
-1
0
2

func IndexInt64

func IndexInt64(slice []int64, target int64) int
Example
Output:

-1
-1
0
2

func IndexInt8

func IndexInt8(slice []int8, target int8) int
Example
Output:

-1
-1
0
2

func IndexInterface

func IndexInterface(slice []interface{}, target interface{}) int
Example
Output:

-1
-1
-1
0
2

func IndexString

func IndexString(slice []string, target string) int
Example
Output:

-1
-1
0
2

func IndexUint

func IndexUint(slice []uint, target uint) int
Example
Output:

-1
-1
0
2

func IndexUint16

func IndexUint16(slice []uint16, target uint16) int
Example
Output:

-1
-1
0
2

func IndexUint32

func IndexUint32(slice []uint32, target uint32) int
Example
Output:

-1
-1
0
2

func IndexUint64

func IndexUint64(slice []uint64, target uint64) int
Example
Output:

-1
-1
0
2

func IndexUint8

func IndexUint8(slice []uint8, target uint8) int
Example
Output:

-1
-1
0
2

func IndexValue

func IndexValue(slice reflect.Value, target interface{}) int
Example
Output:

-1
-1
-1
2

func InsertBool

func InsertBool(slice []bool, i int, value bool) []bool

InsertBool insert value at index i, it panics if i > len(slice). The input slice will be modified.

Example
Output:

[true]
[true]
[true false true]
[false true true]
[false true true]

func InsertGeneric

func InsertGeneric(slice interface{}, i int, value interface{}) interface{}

Insert insert value at index i, it panics if i > len(slice). The input slice will be modified.

Example
Output:

[a]
[a]
[a b c]
[b a c]
[b c a]

func InsertInt

func InsertInt(slice []int, i int, value int) []int

InsertInt insert value at index i, it panics if i > len(slice). The input slice will be modified.

Example
Output:

[3]
[3]
[1 2 3]
[2 1 3]
[2 3 1]

func InsertInt16

func InsertInt16(slice []int16, i int, value int16) []int16

InsertInt16 insert value at index i, it panics if i > len(slice). The input slice will be modified.

Example
Output:

[3]
[3]
[1 2 3]
[2 1 3]
[2 3 1]

func InsertInt32

func InsertInt32(slice []int32, i int, value int32) []int32

InsertInt32 insert value at index i, it panics if i > len(slice). The input slice will be modified.

Example
Output:

[3]
[3]
[1 2 3]
[2 1 3]
[2 3 1]

func InsertInt64

func InsertInt64(slice []int64, i int, value int64) []int64

InsertInt64 insert value at index i, it panics if i > len(slice). The input slice will be modified.

Example
Output:

[3]
[3]
[1 2 3]
[2 1 3]
[2 3 1]

func InsertInt8

func InsertInt8(slice []int8, i int, value int8) []int8

InsertInt8 insert value at index i, it panics if i > len(slice). The input slice will be modified.

Example
Output:

[3]
[3]
[1 2 3]
[2 1 3]
[2 3 1]

func InsertInterface

func InsertInterface(slice []interface{}, i int, value interface{}) []interface{}

InsertInterface insert value at index i, it panics if i > len(slice). The input slice will be modified.

Example
Output:

[a]
[a]
[a b 1]
[b a 1]
[b 1 a]

func InsertString

func InsertString(slice []string, i int, value string) []string

InsertString insert value at index i, it panics if i > len(slice). The input slice will be modified.

Example
Output:

[a]
[a]
[a b c]
[b a c]
[b c a]

func InsertUint

func InsertUint(slice []uint, i int, value uint) []uint

InsertUint insert value at index i, it panics if i > len(slice). The input slice will be modified.

Example
Output:

[3]
[3]
[1 2 3]
[2 1 3]
[2 3 1]

func InsertUint16

func InsertUint16(slice []uint16, i int, value uint16) []uint16

InsertUint16 insert value at index i, it panics if i > len(slice). The input slice will be modified.

Example
Output:

[3]
[3]
[1 2 3]
[2 1 3]
[2 3 1]

func InsertUint32

func InsertUint32(slice []uint32, i int, value uint32) []uint32

InsertUint32 insert value at index i, it panics if i > len(slice). The input slice will be modified.

Example
Output:

[3]
[3]
[1 2 3]
[2 1 3]
[2 3 1]

func InsertUint64

func InsertUint64(slice []uint64, i int, value uint64) []uint64

InsertUint64 insert value at index i, it panics if i > len(slice). The input slice will be modified.

Example
Output:

[3]
[3]
[1 2 3]
[2 1 3]
[2 3 1]

func InsertUint8

func InsertUint8(slice []uint8, i int, value uint8) []uint8

InsertUint8 insert value at index i, it panics if i > len(slice). The input slice will be modified.

Example
Output:

[3]
[3]
[1 2 3]
[2 1 3]
[2 3 1]

func InsertValue

func InsertValue(slice reflect.Value, i int, value reflect.Value) reflect.Value

InsertValue insert value at index i, it panics if i > len(slice). The input slice will be modified.

Example
Output:

[a]
[a]
[a b c]
[b a c]
[b c a]

func IntersectBool

func IntersectBool(left, right []bool) []bool

IntersectBool returns intersection of left and right, in the left order. The duplicate members in left are kept.

Example
Output:

[true false true]
[true true]
[]

func IntersectGeneric

func IntersectGeneric(left, right interface{}) interface{}

IntersectGeneric returns intersection of left and right, in the left order. The duplicate members in left are kept.

Example
Output:

<nil>
[]slice.T(nil)
[{0 } {2 b} {2 b}]

func IntersectInt

func IntersectInt(left, right []int) []int

IntersectInt returns intersection of left and right, in the left order. The duplicate members in left are kept.

Example
Output:

[1 2 2]
[]
[]

func IntersectInt16

func IntersectInt16(left, right []int16) []int16

IntersectInt16 returns intersection of left and right, in the left order. The duplicate members in left are kept.

Example
Output:

[1 2 2]
[]
[]

func IntersectInt32

func IntersectInt32(left, right []int32) []int32

IntersectInt32 returns intersection of left and right, in the left order. The duplicate members in left are kept.

Example
Output:

[1 2 2]
[]
[]

func IntersectInt64

func IntersectInt64(left, right []int64) []int64

IntersectInt64 returns intersection of left and right, in the left order. The duplicate members in left are kept.

Example
Output:

[1 2 2]
[]
[]

func IntersectInt8

func IntersectInt8(left, right []int8) []int8

IntersectInt8 returns intersection of left and right, in the left order. The duplicate members in left are kept.

Example
Output:

[1 2 2]
[]
[]

func IntersectInterface

func IntersectInterface(left, right []interface{}) []interface{}

IntersectInterface returns intersection of left and right, in the left order. The duplicate members in left are kept.

Example
Output:

[1 1 2]
[]
[]

func IntersectString

func IntersectString(left, right []string) []string

IntersectString returns intersection of left and right, in the left order. The duplicate members in left are kept.

Example
Output:

[a b b]
[]
[]

func IntersectUint

func IntersectUint(left, right []uint) []uint

IntersectUint returns intersection of left and right, in the left order. The duplicate members in left are kept.

Example
Output:

[1 2 2]
[]
[]

func IntersectUint16

func IntersectUint16(left, right []uint16) []uint16

IntersectUint16 returns intersection of left and right, in the left order. The duplicate members in left are kept.

Example
Output:

[1 2 2]
[]
[]

func IntersectUint32

func IntersectUint32(left, right []uint32) []uint32

IntersectUint32 returns intersection of left and right, in the left order. The duplicate members in left are kept.

Example
Output:

[1 2 2]
[]
[]

func IntersectUint64

func IntersectUint64(left, right []uint64) []uint64

IntersectUint64 returns intersection of left and right, in the left order. The duplicate members in left are kept.

Example
Output:

[1 2 2]
[]
[]

func IntersectUint8

func IntersectUint8(left, right []uint8) []uint8

IntersectUint8 returns intersection of left and right, in the left order. The duplicate members in left are kept.

Example
Output:

[1 2 2]
[]
[]

func IntersectValue

func IntersectValue(left, right reflect.Value) reflect.Value

IntersectValue returns intersection of left and right, in the left order. The duplicate members in left are kept.

Example
Output:

[]
[]slice.T(nil)
[{0 } {2 b} {2 b}]

func LastIndex

func LastIndex(length int, fun func(int) bool) int
Example
Output:

-1
3
-1

func LastIndexBool

func LastIndexBool(slice []bool, target bool) int
Example
Output:

-1
3
2

func LastIndexGeneric

func LastIndexGeneric(slice interface{}, target interface{}) int
Example
Output:

-1
3
-1

func LastIndexInt

func LastIndexInt(slice []int, target int) int
Example
Output:

3
-1

func LastIndexInt16

func LastIndexInt16(slice []int16, target int16) int
Example
Output:

3
-1

func LastIndexInt32

func LastIndexInt32(slice []int32, target int32) int
Example
Output:

3
-1

func LastIndexInt64

func LastIndexInt64(slice []int64, target int64) int
Example
Output:

3
-1

func LastIndexInt8

func LastIndexInt8(slice []int8, target int8) int
Example
Output:

3
-1

func LastIndexInterface

func LastIndexInterface(slice []interface{}, target interface{}) int
Example
Output:

3
-1

func LastIndexString

func LastIndexString(slice []string, target string) int
Example
Output:

3
-1

func LastIndexUint

func LastIndexUint(slice []uint, target uint) int
Example
Output:

3
-1

func LastIndexUint16

func LastIndexUint16(slice []uint16, target uint16) int
Example
Output:

3
-1

func LastIndexUint32

func LastIndexUint32(slice []uint32, target uint32) int
Example
Output:

3
-1

func LastIndexUint64

func LastIndexUint64(slice []uint64, target uint64) int
Example
Output:

3
-1

func LastIndexUint8

func LastIndexUint8(slice []uint8, target uint8) int
Example
Output:

3
-1

func LastIndexValue

func LastIndexValue(slice reflect.Value, target interface{}) int
Example
Output:

-1
3
-1

func MoveBackward

func MoveBackward(slice interface{}, i, n int) interface{}

MoveBackward move elements starting at i backward n steps. It panics if i > len(slice) The input slice will be modified.

Example
Output:

[0 0 0]
[0 4 5 0 4 5]
[0 4 5 0 4 5]
[0 4 5 0 0 5]
[0 4 5 0 0 0]

func Remove

func Remove(slice interface{}, fun func(int) bool) interface{}
Example
Output:

[2 3]

func RemoveBool

func RemoveBool(slice []bool, targets ...bool) []bool
Example
Output:

[]
[true false false true]
[true true]
[]

func RemoveGeneric

func RemoveGeneric(slice interface{}, targets ...interface{}) interface{}
Example
Output:

[1 2 2 3]
[1 3]

func RemoveInt

func RemoveInt(slice []int, targets ...int) []int
Example
Output:

[1 2 2 3]
[1 3]
[3]

func RemoveInt16

func RemoveInt16(slice []int16, targets ...int16) []int16
Example
Output:

[1 2 2 3]
[1 3]
[3]

func RemoveInt32

func RemoveInt32(slice []int32, targets ...int32) []int32
Example
Output:

[1 2 2 3]
[1 3]
[3]

func RemoveInt64

func RemoveInt64(slice []int64, targets ...int64) []int64
Example
Output:

[1 2 2 3]
[1 3]
[3]

func RemoveInt8

func RemoveInt8(slice []int8, targets ...int8) []int8
Example
Output:

[1 2 2 3]
[1 3]
[3]

func RemoveInterface

func RemoveInterface(slice []interface{}, targets ...interface{}) []interface{}
Example
Output:

[1 2 2 c]
[1 c]
[c]

func RemoveString

func RemoveString(slice []string, targets ...string) []string
Example
Output:

[a b b c]
[a c]
[c]

func RemoveUint

func RemoveUint(slice []uint, targets ...uint) []uint
Example
Output:

[1 2 2 3]
[1 3]
[3]

func RemoveUint16

func RemoveUint16(slice []uint16, targets ...uint16) []uint16
Example
Output:

[1 2 2 3]
[1 3]
[3]

func RemoveUint32

func RemoveUint32(slice []uint32, targets ...uint32) []uint32
Example
Output:

[1 2 2 3]
[1 3]
[3]

func RemoveUint64

func RemoveUint64(slice []uint64, targets ...uint64) []uint64
Example
Output:

[1 2 2 3]
[1 3]
[3]

func RemoveUint8

func RemoveUint8(slice []uint8, targets ...uint8) []uint8
Example
Output:

[1 2 2 3]
[1 3]
[3]

func RemoveValue

func RemoveValue(slice reflect.Value, targets ...interface{}) interface{}
Example
Output:

[2 2]

func SplitBool

func SplitBool(slice []bool, sep bool) (result [][]bool)
Example
Output:

[]
[[] []]
[[true]]
[[true true]]
[[true true] []]
[[true true] [true]]
[[true true] [true true]]
[[true true] [true true] []]

func SplitGeneric

func SplitGeneric(slice, sep interface{}) interface{}
Example
Output:

[]
[[] []]
[[{1 a}]]
[[{1 a} {2 b}]]
[[{1 a} {2 b}] []]
[[{1 a} {2 b}] [{3 c}]]
[[{1 a} {2 b}] [{3 c} {4 d}]]
[[{1 a} {2 b}] [{3 c} {4 d}] []]

func SplitInt

func SplitInt(slice []int, sep int) (result [][]int)
Example
Output:

[]
[[] []]
[[1]]
[[1 2]]
[[1 2] []]
[[1 2] [3]]
[[1 2] [3 4]]
[[1 2] [3 4] []]

func SplitInt16

func SplitInt16(slice []int16, sep int16) (result [][]int16)
Example
Output:

[]
[[] []]
[[1]]
[[1 2]]
[[1 2] []]
[[1 2] [3]]
[[1 2] [3 4]]
[[1 2] [3 4] []]

func SplitInt32

func SplitInt32(slice []int32, sep int32) (result [][]int32)
Example
Output:

[]
[[] []]
[[1]]
[[1 2]]
[[1 2] []]
[[1 2] [3]]
[[1 2] [3 4]]
[[1 2] [3 4] []]

func SplitInt64

func SplitInt64(slice []int64, sep int64) (result [][]int64)
Example
Output:

[]
[[] []]
[[1]]
[[1 2]]
[[1 2] []]
[[1 2] [3]]
[[1 2] [3 4]]
[[1 2] [3 4] []]

func SplitInt8

func SplitInt8(slice []int8, sep int8) (result [][]int8)
Example
Output:

[]
[[] []]
[[1]]
[[1 2]]
[[1 2] []]
[[1 2] [3]]
[[1 2] [3 4]]
[[1 2] [3 4] []]

func SplitInterface

func SplitInterface(slice []interface{}, sep interface{}) (result [][]interface{})
Example
Output:

[]
[[] []]
[[a]]
[[a 1]]
[[a 1] []]
[[a 1] [c]]
[[a 1] [c 3]]
[[a 1] [c 3] []]

func SplitString

func SplitString(slice []string, sep string) (result [][]string)
Example
Output:

[]
[[] []]
[[a]]
[[a b]]
[[a b] []]
[[a b] [c]]
[[a b] [c d]]
[[a b] [c d] []]

func SplitUint

func SplitUint(slice []uint, sep uint) (result [][]uint)
Example
Output:

[]
[[] []]
[[1]]
[[1 2]]
[[1 2] []]
[[1 2] [3]]
[[1 2] [3 4]]
[[1 2] [3 4] []]

func SplitUint16

func SplitUint16(slice []uint16, sep uint16) (result [][]uint16)
Example
Output:

[]
[[] []]
[[1]]
[[1 2]]
[[1 2] []]
[[1 2] [3]]
[[1 2] [3 4]]
[[1 2] [3 4] []]

func SplitUint32

func SplitUint32(slice []uint32, sep uint32) (result [][]uint32)
Example
Output:

[]
[[] []]
[[1]]
[[1 2]]
[[1 2] []]
[[1 2] [3]]
[[1 2] [3 4]]
[[1 2] [3 4] []]

func SplitUint64

func SplitUint64(slice []uint64, sep uint64) (result [][]uint64)
Example
Output:

[]
[[] []]
[[1]]
[[1 2]]
[[1 2] []]
[[1 2] [3]]
[[1 2] [3 4]]
[[1 2] [3 4] []]

func SplitUint8

func SplitUint8(slice []uint8, sep uint8) (result [][]uint8)
Example
Output:

[]
[[] []]
[[1]]
[[1 2]]
[[1 2] []]
[[1 2] [3]]
[[1 2] [3 4]]
[[1 2] [3 4] []]

func SplitValue

func SplitValue(slice reflect.Value, sep interface{}) reflect.Value
Example
Output:

[]
[[] []]
[[{1 a}]]
[[{1 a} {2 b}]]
[[{1 a} {2 b}] []]
[[{1 a} {2 b}] [{3 c}]]
[[{1 a} {2 b}] [{3 c} {4 d}]]
[[{1 a} {2 b}] [{3 c} {4 d}] []]

func SubstractBool

func SubstractBool(left, right []bool) []bool

SubstractBool substracts right from left.

Example
Output:

[]
[true true]
[]
[true false true]
[false]

func SubstractGeneric

func SubstractGeneric(left, right interface{}) interface{}

Substract substracts right from left.

Example
Output:

<nil>
[]
[{3 c} {0 } {2 b} {9 f} {3 c}]
[{3 c} {9 f} {3 c}]

func SubstractInt

func SubstractInt(left, right []int) []int

SubstractInt substracts right from left.

Example
Output:

[]
[1 3 1]
[2]
[1 2 3 1]
[1 2 3 1]

func SubstractInt16

func SubstractInt16(left, right []int16) []int16

SubstractInt16 substracts right from left.

Example
Output:

[]
[1 3 1]
[2]
[1 2 3 1]
[1 2 3 1]

func SubstractInt32

func SubstractInt32(left, right []int32) []int32

SubstractInt32 substracts right from left.

Example
Output:

[]
[1 3 1]
[2]
[1 2 3 1]
[1 2 3 1]

func SubstractInt64

func SubstractInt64(left, right []int64) []int64

SubstractInt64 substracts right from left.

Example
Output:

[]
[1 3 1]
[2]
[1 2 3 1]
[1 2 3 1]

func SubstractInt8

func SubstractInt8(left, right []int8) []int8

SubstractInt8 substracts right from left.

Example
Output:

[]
[1 3 1]
[2]
[1 2 3 1]
[1 2 3 1]

func SubstractInterface

func SubstractInterface(left, right []interface{}) []interface{}

SubstractInterface substracts right from left.

Example
Output:

[]
[a 3 a]
[b]
[a b 3 a]
[a b 3 a]

func SubstractString

func SubstractString(left, right []string) []string

SubstractString substracts right from left.

Example
Output:

[]
[a c a]
[b]
[a b c a]
[a b c a]

func SubstractUint

func SubstractUint(left, right []uint) []uint

SubstractUint substracts right from left.

Example
Output:

[]
[1 3 1]
[2]
[1 2 3 1]
[1 2 3 1]

func SubstractUint16

func SubstractUint16(left, right []uint16) []uint16

SubstractUint16 substracts right from left.

Example
Output:

[]
[1 3 1]
[2]
[1 2 3 1]
[1 2 3 1]

func SubstractUint32

func SubstractUint32(left, right []uint32) []uint32

SubstractUint32 substracts right from left.

Example
Output:

[]
[1 3 1]
[2]
[1 2 3 1]
[1 2 3 1]

func SubstractUint64

func SubstractUint64(left, right []uint64) []uint64

SubstractUint64 substracts right from left.

Example
Output:

[]
[1 3 1]
[2]
[1 2 3 1]
[1 2 3 1]

func SubstractUint8

func SubstractUint8(left, right []uint8) []uint8

SubstractUint8 substracts right from left.

Example
Output:

[]
[1 3 1]
[2]
[1 2 3 1]
[1 2 3 1]

func SubstractValue

func SubstractValue(left, right reflect.Value) reflect.Value

SubstractValue substracts right from left.

Example
Output:

[]
[{3 c} {0 } {2 b} {9 f} {3 c}]
[{3 c} {9 f} {3 c}]

func UnionBool

func UnionBool(left, right []bool) []bool

UnionBool returns union set of left and right, with right follows left. The duplicate members in left are kept.

Example
Output:

[true false true]
[true true false]

func UnionGeneric

func UnionGeneric(left, right interface{}) interface{}

UnionGeneric returns union set of left and right, with right follows left. The duplicate members in left are kept.

Example
Output:

<nil>
[{3 c} {0 } {2 b} {9 f} {2 b}]
[{3 c}]
[{3 c} {0 } {2 b} {9 f} {2 b}]
[{3 c} {0 } {2 b} {9 f} {2 b} {4 d}]

func UnionInt

func UnionInt(left, right []int) []int

UnionInt returns union set of left and right, with right follows left. The duplicate members in left are kept.

Example
Output:

[1 2 2 3 4]

func UnionInt16

func UnionInt16(left, right []int16) []int16

UnionInt16 returns union set of left and right, with right follows left. The duplicate members in left are kept.

Example
Output:

[1 2 2 3 4]

func UnionInt32

func UnionInt32(left, right []int32) []int32

UnionInt32 returns union set of left and right, with right follows left. The duplicate members in left are kept.

Example
Output:

[1 2 2 3 4]

func UnionInt64

func UnionInt64(left, right []int64) []int64

UnionInt64 returns union set of left and right, with right follows left. The duplicate members in left are kept.

Example
Output:

[1 2 2 3 4]

func UnionInt8

func UnionInt8(left, right []int8) []int8

UnionInt8 returns union set of left and right, with right follows left. The duplicate members in left are kept.

Example
Output:

[1 2 2 3 4]

func UnionInterface

func UnionInterface(left, right []interface{}) []interface{}

UnionInterface returns union set of left and right, with right follows left. The duplicate members in left are kept.

Example
Output:

[1 2 2 3 4 4]

func UnionString

func UnionString(left, right []string) []string

UnionString returns union set of left and right, with right follows left. The duplicate members in left are kept.

Example
Output:

[1 2 2 3 4]

func UnionUint

func UnionUint(left, right []uint) []uint

UnionUint returns union set of left and right, with right follows left. The duplicate members in left are kept.

Example
Output:

[1 2 2 3 4]

func UnionUint16

func UnionUint16(left, right []uint16) []uint16

UnionUint16 returns union set of left and right, with right follows left. The duplicate members in left are kept.

Example
Output:

[1 2 2 3 4]

func UnionUint32

func UnionUint32(left, right []uint32) []uint32

UnionUint32 returns union set of left and right, with right follows left. The duplicate members in left are kept.

Example
Output:

[1 2 2 3 4]

func UnionUint64

func UnionUint64(left, right []uint64) []uint64

UnionUint64 returns union set of left and right, with right follows left. The duplicate members in left are kept.

Example
Output:

[1 2 2 3 4]

func UnionUint8

func UnionUint8(left, right []uint8) []uint8

UnionUint8 returns union set of left and right, with right follows left. The duplicate members in left are kept.

Example
Output:

[1 2 2 3 4]

func UnionValue

func UnionValue(left, right reflect.Value) reflect.Value

UnionValue returns union set of left and right, with right follows left. The duplicate members in left are kept.

Example
Output:

false

func UniqueBool

func UniqueBool(slice []bool) []bool

Input slice will be modified.

Example
Output:

[true false]

func UniqueBy

func UniqueBy(slice interface{}, keyFunc func(i int) interface{}, keepLast bool) interface{}

UniqueBy will change the original slice, Use copy to keep the original slice. The input slice will be modified. If param keepLast is true, the last one of the same elements is kept, otherwise the first one is kept.

Example
Output:

[]
[{1 a} {2 a}]
Example (KeepLast)
Output:

[]
[{1 b} {2 b}]

func UniqueByValue

func UniqueByValue(slice reflect.Value, keyFunc func(i int) interface{}, keepLast bool) reflect.Value

UniqueByValue will change the original slice, Use copy to keep the original slice. The input slice will be modified. If param keepLast is true, the last one of the same elements is kept, otherwise the first one is kept.

func UniqueField

func UniqueField(slice interface{}, fieldPaths ...string) (result []interface{})

UniqueField returns unique values of field from a struct slice

Example
Output:

[1 2 3]
[a b c]

func UniqueFieldBool

func UniqueFieldBool(slice interface{}, fieldPaths ...string) (result []bool)

UniqueFieldBool returns unique values of field from a struct slice

Example
Output:

[true]

func UniqueFieldInt

func UniqueFieldInt(slice interface{}, fieldPaths ...string) (result []int)

UniqueFieldInt returns unique values of field from a struct slice

Example
Output:

[1 2 3]

func UniqueFieldInt16

func UniqueFieldInt16(slice interface{}, fieldPaths ...string) (result []int16)

UniqueFieldInt16 returns unique values of field from a struct slice

Example
Output:

[1 2 3]

func UniqueFieldInt32

func UniqueFieldInt32(slice interface{}, fieldPaths ...string) (result []int32)

UniqueFieldInt32 returns unique values of field from a struct slice

Example
Output:

[1 2 3]

func UniqueFieldInt64

func UniqueFieldInt64(slice interface{}, fieldPaths ...string) (result []int64)

UniqueFieldInt64 returns unique values of field from a struct slice

Example
Output:

[1 2 3]

func UniqueFieldInt8

func UniqueFieldInt8(slice interface{}, fieldPaths ...string) (result []int8)

UniqueFieldInt8 returns unique values of field from a struct slice

Example
Output:

[1 2 3]

func UniqueFieldString

func UniqueFieldString(slice interface{}, fieldPaths ...string) (result []string)

UniqueFieldString returns unique values of field from a struct slice

Example
Output:

[a b c]

func UniqueFieldUint

func UniqueFieldUint(slice interface{}, fieldPaths ...string) (result []uint)

UniqueFieldUint returns unique values of field from a struct slice

Example
Output:

[1 2 3]

func UniqueFieldUint16

func UniqueFieldUint16(slice interface{}, fieldPaths ...string) (result []uint16)

UniqueFieldUint16 returns unique values of field from a struct slice

Example
Output:

[1 2 3]

func UniqueFieldUint32

func UniqueFieldUint32(slice interface{}, fieldPaths ...string) (result []uint32)

UniqueFieldUint32 returns unique values of field from a struct slice

Example
Output:

[1 2 3]

func UniqueFieldUint64

func UniqueFieldUint64(slice interface{}, fieldPaths ...string) (result []uint64)

UniqueFieldUint64 returns unique values of field from a struct slice

Example
Output:

[1 2 3]

func UniqueFieldUint8

func UniqueFieldUint8(slice interface{}, fieldPaths ...string) (result []uint8)

UniqueFieldUint8 returns unique values of field from a struct slice

Example
Output:

[1 2 3]

func UniqueGeneric

func UniqueGeneric(slice interface{}) interface{}

Input slice will be modified.

Example
Output:

[{1 a} {2 b} {0 } {3 c}]

func UniqueInt

func UniqueInt(slice []int) []int

Input slice will be modified.

Example
Output:

[0 1 2 3 4]

func UniqueInt16

func UniqueInt16(slice []int16) []int16

Input slice will be modified.

Example
Output:

[0 1 2 3 4]

func UniqueInt32

func UniqueInt32(slice []int32) []int32

Input slice will be modified.

Example
Output:

[0 1 2 3 4]

func UniqueInt64

func UniqueInt64(slice []int64) []int64

Input slice will be modified.

Example
Output:

[0 1 2 3 4]

func UniqueInt8

func UniqueInt8(slice []int8) []int8

Input slice will be modified.

Example
Output:

[0 1 2 3 4]

func UniqueInterface

func UniqueInterface(slice []interface{}) []interface{}

Input slice will be modified.

Example
Output:

[0 1 2 true 4]

func UniqueString

func UniqueString(slice []string) []string

Input slice will be modified.

Example
Output:

[0 a b c d]

func UniqueUint

func UniqueUint(slice []uint) []uint

Input slice will be modified.

Example
Output:

[0 1 2 3 4]

func UniqueUint16

func UniqueUint16(slice []uint16) []uint16

Input slice will be modified.

Example
Output:

[0 1 2 3 4]

func UniqueUint32

func UniqueUint32(slice []uint32) []uint32

Input slice will be modified.

Example
Output:

[0 1 2 3 4]

func UniqueUint64

func UniqueUint64(slice []uint64) []uint64

Input slice will be modified.

Example
Output:

[0 1 2 3 4]

func UniqueUint8

func UniqueUint8(slice []uint8) []uint8

Input slice will be modified.

Example
Output:

[0 1 2 3 4]

func UniqueValue

func UniqueValue(slice reflect.Value) reflect.Value

Input slice will be modified.

Example
Output:

[{1 a} {2 b} {0 } {3 c}]

Types

This section is empty.

Jump to

Keyboard shortcuts

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