Documentation
¶
Index ¶
- type UiInt64s
- func (s *UiInt64s) Append(data ...uint64)
- func (s UiInt64s) Cap() int
- func (s UiInt64s) Copy() UiInt64s
- func (s *UiInt64s) Insert(index int, data ...uint64)
- func (s UiInt64s) Len() int
- func (s UiInt64s) Less(i, j int) bool
- func (s *UiInt64s) Prepend(data ...uint64)
- func (s *UiInt64s) Remove(index, num int) int
- func (s UiInt64s) ReverseSort() UiInt64s
- func (s UiInt64s) Shuffle() UiInt64s
- func (s UiInt64s) Sort() UiInt64s
- func (s UiInt64s) Swap(i, j int)
- type Uint8s
- func (s *Uint8s) Append(data ...uint8)
- func (s Uint8s) Cap() int
- func (s Uint8s) Copy() Uint8s
- func (s *Uint8s) Insert(index int, data ...uint8)
- func (s Uint8s) Len() int
- func (s Uint8s) Less(i, j int) bool
- func (s *Uint8s) Prepend(data ...uint8)
- func (s *Uint8s) Remove(index, num int) int
- func (s Uint8s) ReverseSort() Uint8s
- func (s Uint8s) Shuffle() Uint8s
- func (s Uint8s) Sort() Uint8s
- func (s Uint8s) Swap(i, j int)
- type Uint16s
- func (s *Uint16s) Append(data ...uint16)
- func (s Uint16s) Cap() int
- func (s Uint16s) Copy() Uint16s
- func (s *Uint16s) Insert(index int, data ...uint16)
- func (s Uint16s) Len() int
- func (s Uint16s) Less(i, j int) bool
- func (s *Uint16s) Prepend(data ...uint16)
- func (s *Uint16s) Remove(index, num int) int
- func (s Uint16s) ReverseSort() Uint16s
- func (s Uint16s) Shuffle() Uint16s
- func (s Uint16s) Sort() Uint16s
- func (s Uint16s) Swap(i, j int)
- type Uint32s
- func (s *Uint32s) Append(data ...uint32)
- func (s Uint32s) Cap() int
- func (s Uint32s) Copy() Uint32s
- func (s *Uint32s) Insert(index int, data ...uint32)
- func (s Uint32s) Len() int
- func (s Uint32s) Less(i, j int) bool
- func (s *Uint32s) Prepend(data ...uint32)
- func (s *Uint32s) Remove(index, num int) int
- func (s Uint32s) ReverseSort() Uint32s
- func (s Uint32s) Shuffle() Uint32s
- func (s Uint32s) Sort() Uint32s
- func (s Uint32s) Swap(i, j int)
- type Uints
- func (s *Uints) Append(data ...uint)
- func (s Uints) Cap() int
- func (s Uints) Copy() Uints
- func (s *Uints) Insert(index int, data ...uint)
- func (s Uints) Len() int
- func (s Uints) Less(i, j int) bool
- func (s *Uints) Prepend(data ...uint)
- func (s *Uints) Remove(index, num int) int
- func (s Uints) ReverseSort() Uints
- func (s Uints) Shuffle() Uints
- func (s Uints) Sort() Uints
- func (s Uints) Swap(i, j int)
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) ReverseSort ¶
type Uint8s ¶
type Uint8s []uint8
Uint8s 定义方便操作[]uint8的类型
func (Uint8s) ReverseSort ¶
type Uint16s ¶
type Uint16s []uint16
Uint16s 定义方便操作[]uint16的类型
func (Uint16s) ReverseSort ¶
type Uint32s ¶
type Uint32s []uint32
Uint32s 定义方便操作[]uint32的类型
func (Uint32s) ReverseSort ¶
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) ReverseSort ¶
Click to show internal directories.
Click to hide internal directories.