matrix

package
v1.0.17 Latest Latest
Warning

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

Go to latest
Published: May 3, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package matrix 矩阵.

包括 Bytes.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bytes

type Bytes [][]byte

Bytes 字节码矩阵.

Example
package main

import (
	"fmt"
	"sort"

	"gitee.com/xuender/oils/matrix"
)

func main() {
	s := matrix.Bytes{[]byte("world"), []byte("hello")}

	fmt.Println(string(s[0]))
	fmt.Println(string(s[1]))
	fmt.Println(s.All([]byte("hello"), []byte("world")))
	fmt.Println(s.Any([]byte("xxx"), []byte("hello")))
	fmt.Println(s.Has([]byte("hello")))
	fmt.Println(s.Index([]byte("world")))
	fmt.Println(s.Index([]byte("xxx")))
	sort.Sort(s)
	fmt.Println(s)

}
Output:

world
hello
true
true
true
0
-1
hello, world

func (Bytes) All

func (x Bytes) All(elems ...[]byte) bool

All 全部包含.

func (Bytes) Any

func (x Bytes) Any(elems ...[]byte) bool

Any 任意包含.

func (*Bytes) Del

func (x *Bytes) Del(index int) Bytes

Del 根据序号删除.

func (Bytes) Equal

func (x Bytes) Equal(elem Bytes) bool

Equal 相等.

func (Bytes) Has

func (x Bytes) Has(r []byte) bool

Has 包含.

func (Bytes) Index

func (x Bytes) Index(r []byte) int

Index 位置.

func (Bytes) Join

func (x Bytes) Join(sep string) string

Join 集合连接.

func (Bytes) Len

func (x Bytes) Len() int

func (Bytes) Less

func (x Bytes) Less(i, j int) bool

func (Bytes) String

func (x Bytes) String() string

String 转换成字符串.

func (Bytes) Swap

func (x Bytes) Swap(i, j int)

Jump to

Keyboard shortcuts

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