uints

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type UiInt64s

type UiInt64s []uint64

UiInt64s 定义方便操作[]uint64的类型

func (*UiInt64s) Append

func (s *UiInt64s) Append(data ...uint64)

Append 追加数据

func (UiInt64s) Cap

func (s UiInt64s) Cap() int

Cap 返回slice容量

func (UiInt64s) Copy

func (s UiInt64s) Copy() UiInt64s

Copy 拷贝一份数据

func (*UiInt64s) Insert

func (s *UiInt64s) Insert(index int, data ...uint64)

Insert 插入数据

func (UiInt64s) Len

func (s UiInt64s) Len() int

Len 返回slice长度

func (UiInt64s) Less

func (s UiInt64s) Less(i, j int) bool

Less 比较两个位置上的数据

func (*UiInt64s) Prepend

func (s *UiInt64s) Prepend(data ...uint64)

Prepend 向前添加数据

func (*UiInt64s) Remove

func (s *UiInt64s) Remove(index, num int) int

Remove 从指定位置删除指定数量的数据,返回被删除的数据数量

func (UiInt64s) ReverseSort

func (s UiInt64s) ReverseSort() UiInt64s

func (UiInt64s) Shuffle

func (s UiInt64s) Shuffle() UiInt64s

Shuffle 随机打乱slice数据

func (UiInt64s) Sort

func (s UiInt64s) Sort() UiInt64s

Sort 对切片进行排序

func (UiInt64s) Swap

func (s UiInt64s) Swap(i, j int)

Swap 交换两个位置上的数据

type Uint8s

type Uint8s []uint8

Uint8s 定义方便操作[]uint8的类型

func (*Uint8s) Append

func (s *Uint8s) Append(data ...uint8)

Append 追加数据

func (Uint8s) Cap

func (s Uint8s) Cap() int

Cap 返回slice容量

func (Uint8s) Copy

func (s Uint8s) Copy() Uint8s

Copy 拷贝一份数据

func (*Uint8s) Insert

func (s *Uint8s) Insert(index int, data ...uint8)

Insert 插入数据

func (Uint8s) Len

func (s Uint8s) Len() int

Len 返回slice长度

func (Uint8s) Less

func (s Uint8s) Less(i, j int) bool

Less 比较两个位置上的数据

func (*Uint8s) Prepend

func (s *Uint8s) Prepend(data ...uint8)

Prepend 向前添加数据

func (*Uint8s) Remove

func (s *Uint8s) Remove(index, num int) int

Remove 从指定位置删除指定数量的数据,返回被删除的数据数量

func (Uint8s) ReverseSort

func (s Uint8s) ReverseSort() Uint8s

func (Uint8s) Shuffle

func (s Uint8s) Shuffle() Uint8s

Shuffle 随机打乱slice数据

func (Uint8s) Sort

func (s Uint8s) Sort() Uint8s

Sort 对切片进行排序

func (Uint8s) Swap

func (s Uint8s) Swap(i, j int)

Swap 交换两个位置上的数据

type Uint16s

type Uint16s []uint16

Uint16s 定义方便操作[]uint16的类型

func (*Uint16s) Append

func (s *Uint16s) Append(data ...uint16)

Append 追加数据

func (Uint16s) Cap

func (s Uint16s) Cap() int

Cap 返回slice容量

func (Uint16s) Copy

func (s Uint16s) Copy() Uint16s

Copy 拷贝一份数据

func (*Uint16s) Insert

func (s *Uint16s) Insert(index int, data ...uint16)

Insert 插入数据

func (Uint16s) Len

func (s Uint16s) Len() int

Len 返回slice长度

func (Uint16s) Less

func (s Uint16s) Less(i, j int) bool

Less 比较两个位置上的数据

func (*Uint16s) Prepend

func (s *Uint16s) Prepend(data ...uint16)

Prepend 向前添加数据

func (*Uint16s) Remove

func (s *Uint16s) Remove(index, num int) int

Remove 从指定位置删除指定数量的数据,返回被删除的数据数量

func (Uint16s) ReverseSort

func (s Uint16s) ReverseSort() Uint16s

func (Uint16s) Shuffle

func (s Uint16s) Shuffle() Uint16s

Shuffle 随机打乱slice数据

func (Uint16s) Sort

func (s Uint16s) Sort() Uint16s

Sort 对切片进行排序

func (Uint16s) Swap

func (s Uint16s) Swap(i, j int)

Swap 交换两个位置上的数据

type Uint32s

type Uint32s []uint32

Uint32s 定义方便操作[]uint32的类型

func (*Uint32s) Append

func (s *Uint32s) Append(data ...uint32)

Append 追加数据

func (Uint32s) Cap

func (s Uint32s) Cap() int

Cap 返回slice容量

func (Uint32s) Copy

func (s Uint32s) Copy() Uint32s

Copy 拷贝一份数据

func (*Uint32s) Insert

func (s *Uint32s) Insert(index int, data ...uint32)

Insert 插入数据

func (Uint32s) Len

func (s Uint32s) Len() int

Len 返回slice长度

func (Uint32s) Less

func (s Uint32s) Less(i, j int) bool

Less 比较两个位置上的数据

func (*Uint32s) Prepend

func (s *Uint32s) Prepend(data ...uint32)

Prepend 向前添加数据

func (*Uint32s) Remove

func (s *Uint32s) Remove(index, num int) int

Remove 从指定位置删除指定数量的数据,返回被删除的数据数量

func (Uint32s) ReverseSort

func (s Uint32s) ReverseSort() Uint32s

func (Uint32s) Shuffle

func (s Uint32s) Shuffle() Uint32s

Shuffle 随机打乱slice数据

func (Uint32s) Sort

func (s Uint32s) Sort() Uint32s

Sort 对切片进行排序

func (Uint32s) Swap

func (s Uint32s) Swap(i, j int)

Swap 交换两个位置上的数据

type Uints

type Uints []uint

Uints 定义方便操作[]uint的类型

Example
package main

import (
	"fmt"

	"github.com/recallsong/go-utils/container/slice/uints"
)

func main() {
	s := uints.Uints{}
	s.Append(1, 2)
	s.Prepend(4, 3, 2, 1, 0)
	s.Insert(1, 3, 4, 5, 6)
	fmt.Println(s, s.Len())

	s1 := s.Copy()
	removed := s1.Remove(3, 6)
	fmt.Println(s1, s1.Len(), removed)
}
Output:
[4 3 4 5 6 3 2 1 0 1 2] 11
[4 3 4 1 2] 5 6
Example (Order)
package main

import (
	"fmt"

	"github.com/recallsong/go-utils/container/slice/uints"
)

func main() {
	s := uints.Uints{}
	s.Append(9, 1, 8, 2, 7, 3, 6, 4, 5)
	s.Sort()
	fmt.Println(s)
	s.ReverseSort()
	fmt.Println(s)

	s.Shuffle() //随机打乱数据
	// fmt.Println(s)

}
Output:
[1 2 3 4 5 6 7 8 9]
[9 8 7 6 5 4 3 2 1]

func (*Uints) Append

func (s *Uints) Append(data ...uint)

Append 追加数据

func (Uints) Cap

func (s Uints) Cap() int

Cap 返回slice容量

func (Uints) Copy

func (s Uints) Copy() Uints

Copy 拷贝一份数据

func (*Uints) Insert

func (s *Uints) Insert(index int, data ...uint)

Insert 插入数据

func (Uints) Len

func (s Uints) Len() int

Len 返回slice长度

func (Uints) Less

func (s Uints) Less(i, j int) bool

Less 比较两个位置上的数据

func (*Uints) Prepend

func (s *Uints) Prepend(data ...uint)

Prepend 向前添加数据

func (*Uints) Remove

func (s *Uints) Remove(index, num int) int

Remove 从指定位置删除指定数量的数据,返回被删除的数据数量

func (Uints) ReverseSort

func (s Uints) ReverseSort() Uints

func (Uints) Shuffle

func (s Uints) Shuffle() Uints

Shuffle 随机打乱slice数据

func (Uints) Sort

func (s Uints) Sort() Uints

Sort 对切片进行排序

func (Uints) Swap

func (s Uints) Swap(i, j int)

Swap 交换两个位置上的数据

Jump to

Keyboard shortcuts

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