slice

package module
v0.0.0-...-8f6f7ef Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: MIT Imports: 5 Imported by: 0

README

包(github.com/yudeguang17/slice),用于切片处理时经常会遇到的一些操作,主要包括如下函数:

  • Copy 安全复制

  • Contains 判断是否包含

  • InsertIgnore 插入不重复元素

  • DeleteByElement 根据元素删除(不会改变原有切片)

  • DeleteByIndex 根据下标范围删除,也可以只删除单个下标位置的元素(不会改变原有切片)

  • Distinct 去重复(元素个数较大时会自动切换为hash算法)

  • InnerJoin 内连接(元素个数较大时会自动切换为hash算法)

  • Union 合并去重(元素个数较大时会自动切换为hash算法)

  • NotIn 相减--返回mNotInN(元素个数较大时会自动切换为hash算法)

  • Left 返回左侧若干元素

  • Right 返回右侧若干元素

  • Reverse 倒序排列

  • Shuffling 随机

  • Sort 排序

由于go暂时不支持泛型,所以目前是针对每一种基础类型(int,string等)都分别编写了所对应的相关函数。以string类型为列:

package main

import (
	"fmt"
	"github.com/yudeguang17/slice"
	"github.com/yudeguang17/stringsx"
	"log"
)

func main() {
	log.SetFlags(log.Lshortfile | log.Ltime)
	s1 := "abcdefabcdef3434"
	s2 := "bcdefgbcdefg02323"
	m := stringsx.SplitByLen(s1, 1)
	n := stringsx.SplitByLen(s2, 1)
	//先观察一下两个切片
	log.Println("原始m,n分别如下:")
	log.Println("m为:")
	log.Println(m)
	log.Println("n为:")
	log.Println(n)

	//复制
	fmt.Println("")
	log.Println("复制CopyString:")
	copyM := slice.CopyString(m)
	log.Println("copyM为:")
	log.Println(copyM)
	log.Println("m为:")
	log.Println(m)
	log.Printf("copyM的地址:%p", copyM)
	log.Printf("    m的地址:%p", m)
	/*
			增删改查
			增:实现了InsertIgnore
		    删:实现以下两种,根据元素值删除DeleteByElement,根据下标索引位置删除DeleteByIndex
	*/
	//插入不重复数据
	fmt.Println("")
	log.Println("插入不重复数据InsertIgnoreString:")
	log.Println("m插入元素y后:")
	log.Println(slice.InsertIgnoreString(m, "y"))
	log.Println("m为:")
	log.Println(m)
	log.Println("m插入元素a后:")
	log.Println(slice.InsertIgnoreString(m, "a"))
	log.Println("m为:")
	log.Println(m)

	//删除某个元素
	fmt.Println("")
	log.Println("删除元素DeleteByElementString:")
	log.Println("m删除元素a后的结果为:")
	log.Println(slice.DeleteByElementString(m, "a"))
	log.Println("m为:")
	log.Println(m)

	//删除第i个元素
	fmt.Println("")
	log.Println("删除第i个元素DeleteByIndexString:")
	log.Println("m删除下标为3的元素后的结果为:")
	log.Println(slice.DeleteByIndexString(m, 3))
	log.Println("m为:")
	log.Println(m)

	//删除一段元素
	fmt.Println("")
	log.Println("删除一段元素DeleteByIndexString:")
	log.Println("m删除下标从3到5(不包含5)的元素后的结果为:")
	log.Println(slice.DeleteByIndexString(m, 3, 5))
	log.Println("m为:")
	log.Println(m)

	//是否包含
	fmt.Println("")
	log.Println("是否包含ContainsString:")
	log.Println("m是否包含元素a", slice.ContainsString(m, "a"))
	log.Println("m是否包含元素x", slice.ContainsString(m, "x"))
	log.Println("m为:")
	log.Println(m)

	//去重复
	fmt.Println("")
	log.Println("去重复DistinctString:")
	log.Println("m去重复后的结果为:")
	log.Println(slice.DistinctString(m))
	log.Println("m为:")
	log.Println(m)
	/*
		集合操作,实现了:
		innerJoin
		union
		notin
	*/
	//内连接
	fmt.Println("")
	log.Println("内连接innerJoinString:")
	log.Println("m与n内连接结果为:")
	log.Println(slice.InnerJoinString(m, n))
	log.Println("m为:")
	log.Println(m)
	log.Println("n为:")
	log.Println(n)

	//合并去重
	fmt.Println("")
	log.Println("合并去重UnionString:")
	log.Println("m与n合并去重结果为:")
	log.Println(slice.UnionString(m, n))
	log.Println("m为:")
	log.Println(m)
	log.Println("n为:")
	log.Println(n)

	//集合m不在集合n中的元素即m-n 注意,不对m做去重操作
	fmt.Println("")
	log.Println("相减NotInString:")
	log.Println("m-n结果为:")
	log.Println(slice.NotInString(m, n))
	log.Println("m为:")
	log.Println(m)
	log.Println("n为:")
	log.Println(n)
	/*
		以下操作会改变切片本身
		Reverse
		sort
		Shuffling
	*/
	//倒序
	fmt.Println("")
	log.Println("倒序ReverseString:")
	slice.ReverseString(m)
	log.Println("m为:")
	log.Println(m)

	//从小到大排序
	fmt.Println("")
	log.Println("排序SortString:")
	slice.SortString(m)
	log.Println("m为:")
	log.Println(m)

	//随机打乱
	fmt.Println("")
	log.Println("随机打乱ShufflingString:")
	slice.ShufflingString(m)
	log.Println("m为:")
	log.Println(m)
	slice.ShufflingString(m)
	log.Println("m为:")
	log.Println(m)
}

执行结果如下:

22:32:41 main.go:17: 原始m,n分别如下:
22:32:41 main.go:18: m为:
22:32:41 main.go:19: [a b c d e f a b c d e f 3 4 3 4]
22:32:41 main.go:20: n为:
22:32:41 main.go:21: [b c d e f g b c d e f g 0 2 3 2 3]

22:32:41 main.go:25: 复制CopyString:
22:32:41 main.go:27: copyM为:
22:32:41 main.go:28: [a b c d e f a b c d e f 3 4 3 4]
22:32:41 main.go:29: m为:
22:32:41 main.go:30: [a b c d e f a b c d e f 3 4 3 4]
22:32:41 main.go:31: copyM的地址:0xc042086100
22:32:41 main.go:32:     m的地址:0xc042086000

22:32:41 main.go:40: 插入不重复数据InsertIgnoreString:
22:32:41 main.go:41: m插入元素y后:
22:32:41 main.go:42: [a b c d e f a b c d e f 3 4 3 4 y]
22:32:41 main.go:43: m为:
22:32:41 main.go:44: [a b c d e f a b c d e f 3 4 3 4]
22:32:41 main.go:45: m插入元素a后:
22:32:41 main.go:46: [a b c d e f a b c d e f 3 4 3 4]
22:32:41 main.go:47: m为:
22:32:41 main.go:48: [a b c d e f a b c d e f 3 4 3 4]

22:32:41 main.go:52: 删除元素DeleteByElementString:
22:32:41 main.go:53: m删除元素a后的结果为:
22:32:41 main.go:54: [b c d e f b c d e f 3 4 3 4]
22:32:41 main.go:55: m为:
22:32:41 main.go:56: [a b c d e f a b c d e f 3 4 3 4]

22:32:41 main.go:60: 删除第i个元素DeleteByIndexString:
22:32:41 main.go:61: m删除下标为3的元素后的结果为:
22:32:41 main.go:62: [a b c e f a b c d e f 3 4 3 4]
22:32:41 main.go:63: m为:
22:32:41 main.go:64: [a b c d e f a b c d e f 3 4 3 4]

22:32:41 main.go:68: 删除一段元素DeleteByIndexString:
22:32:41 main.go:69: m删除下标从3到5(不包含5)的元素后的结果为:
22:32:41 main.go:70: [a b c f a b c d e f 3 4 3 4]
22:32:41 main.go:71: m为:
22:32:41 main.go:72: [a b c d e f a b c d e f 3 4 3 4]

22:32:41 main.go:76: 是否包含ContainsString:
22:32:41 main.go:77: m是否包含元素a true
22:32:41 main.go:78: m是否包含元素x false
22:32:41 main.go:79: m为:
22:32:41 main.go:80: [a b c d e f a b c d e f 3 4 3 4]

22:32:41 main.go:84: 去重复DistinctString:
22:32:41 main.go:85: m去重复后的结果为:
22:32:41 main.go:86: [a b c d e f 3 4]
22:32:41 main.go:87: m为:
22:32:41 main.go:88: [a b c d e f a b c d e f 3 4 3 4]

22:32:41 main.go:97: 内连接innerJoinString:
22:32:41 main.go:98: m与n内连接结果为:
22:32:41 main.go:99: [b c d e f 3]
22:32:41 main.go:100: m为:
22:32:41 main.go:101: [a b c d e f a b c d e f 3 4 3 4]
22:32:41 main.go:102: n为:
22:32:41 main.go:103: [b c d e f g b c d e f g 0 2 3 2 3]

22:32:41 main.go:107: 合并去重UnionString:
22:32:41 main.go:108: m与n合并去重结果为:
22:32:41 main.go:109: [a b c d e f 3 4 g 0 2]
22:32:41 main.go:110: m为:
22:32:41 main.go:111: [a b c d e f a b c d e f 3 4 3 4]
22:32:41 main.go:112: n为:
22:32:41 main.go:113: [b c d e f g b c d e f g 0 2 3 2 3]

22:32:41 main.go:117: 相减NotInString:
22:32:41 main.go:118: m-n结果为:
22:32:41 main.go:119: [a a 4 4]
22:32:41 main.go:120: m为:
22:32:41 main.go:121: [a b c d e f a b c d e f 3 4 3 4]
22:32:41 main.go:122: n为:
22:32:41 main.go:123: [b c d e f g b c d e f g 0 2 3 2 3]

22:32:41 main.go:132: 倒序ReverseString:
22:32:41 main.go:134: m为:
22:32:41 main.go:135: [4 3 4 3 f e d c b a f e d c b a]

22:32:41 main.go:139: 排序SortString:
22:32:41 main.go:141: m为:
22:32:41 main.go:142: [3 3 4 4 a a b b c c d d e e f f]

22:32:41 main.go:146: 随机打乱ShufflingString:
22:32:41 main.go:148: m为:
22:32:41 main.go:149: [b c 4 3 4 e c a 3 a e b f d f d]
22:32:41 main.go:151: m为:
22:32:41 main.go:152: [a a 4 b 3 f 3 e c 4 d c d b f e]

Documentation

Overview

Copyright 2020 slice Author(https://github.com/yudeguang17/slice). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/slice.

Copyright 2020 slice Author(https://github.com/yudeguang17/slice). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/slice.

Copyright 2020 slice Author(https://github.com/yudeguang17/slice). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/slice.

Copyright 2020 slice Author(https://github.com/yudeguang17/slice). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/slice.

DeleteByIndexright 2020 slice Author(https://github.com/yudeguang17/slice). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a DeleteByIndex of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/slice.

Copyright 2020 slice Author(https://github.com/yudeguang17/slice). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/slice.

Copyright 2020 slice Author(https://github.com/yudeguang17/slice). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/slice.

Copyright 2020 slice Author(https://github.com/yudeguang17/slice). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/slice.

Copyright 2020 slice Author(https://github.com/yudeguang17/slice). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/slice.

Copyright 2020 slice Author(https://github.com/yudeguang17/slice). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/slice.

Copyright 2020 slice Author(https://github.com/yudeguang17/slice). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/slice.

Reverseright 2020 slice Author(https://github.com/yudeguang17/slice). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/slice.

Copyright 2020 slice Author(https://github.com/yudeguang17/slice). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/slice.

Sortright 2020 slice Author(https://github.com/yudeguang17/slice). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/slice.

Copyright 2020 slice Author(https://github.com/yudeguang17/slice). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/slice.

Copyright 2020 slice Author(https://github.com/yudeguang17/slice). All Rights Reserved.

This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang17/slice.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(s []interface{}, v interface{}) bool

返回切片sli中是否包含单个元素v

func ContainsBool

func ContainsBool(s []bool, v bool) bool

返回切片sli中是否包含单个元素v

func ContainsByte

func ContainsByte(s []byte, v byte) bool

返回切片sli中是否包含单个元素v

func ContainsComplex64

func ContainsComplex64(s []complex64, v complex64) bool

返回切片sli中是否包含单个元素v

func ContainsComplex128

func ContainsComplex128(s []complex128, v complex128) bool

返回切片sli中是否包含单个元素v

func ContainsFloat32

func ContainsFloat32(s []float32, v float32) bool

返回切片sli中是否包含单个元素v

func ContainsFloat64

func ContainsFloat64(s []float64, v float64) bool

返回切片sli中是否包含单个元素v

func ContainsInt

func ContainsInt(s []int, v int) bool

返回切片sli中是否包含单个元素v

func ContainsInt8

func ContainsInt8(s []int8, v int8) bool

返回切片sli中是否包含单个元素v

func ContainsInt16

func ContainsInt16(s []int16, v int16) bool

返回切片sli中是否包含单个元素v

func ContainsInt32

func ContainsInt32(s []int32, v int32) bool

返回切片sli中是否包含单个元素v

func ContainsInt64

func ContainsInt64(s []int64, v int64) bool

返回切片sli中是否包含单个元素v

func ContainsRune

func ContainsRune(s []rune, v rune) bool

返回切片sli中是否包含单个元素v

func ContainsString

func ContainsString(s []string, v string) bool

返回切片sli中是否包含单个元素v

func ContainsUint

func ContainsUint(s []uint, v uint) bool

返回切片sli中是否包含单个元素v

func ContainsUint8

func ContainsUint8(s []uint8, v uint8) bool

返回切片sli中是否包含单个元素v

func ContainsUint16

func ContainsUint16(s []uint16, v uint16) bool

返回切片sli中是否包含单个元素v

func ContainsUint32

func ContainsUint32(s []uint32, v uint32) bool

返回切片sli中是否包含单个元素v

func ContainsUint64

func ContainsUint64(s []uint64, v uint64) bool

返回切片sli中是否包含单个元素v

func ContainsUintptr

func ContainsUintptr(s []uintptr, v uintptr) bool

返回切片sli中是否包含单个元素v

func ContainsUniqueString

func ContainsUniqueString(s []unique.Handle[string], v unique.Handle[string]) bool

返回切片sli中是否包含单个元素v

func Copy

func Copy(s []interface{}) []interface{}

see https://github.com/golang/go/wiki/SliceTricks append(s[:0:0], s...) 表示在一个空切片基础上插入s 从数组或者切片派生切片(取子切片)有两以下两种方式 s[low : high] // 双下标形式 s[low : high : max] // 三下标形式 双下标实际是三下标的简写 s[low : high] ==>s[low : high:cap(s)] 以下切片等价 s[0 : len(s)] s[: len(s)] s[0 :] s[:] s[0 : len(s) : cap(s)] s[: len(s) : cap(s)]

安全的复制切片

func CopyBool

func CopyBool(s []bool) []bool

安全的复制切片

func CopyByte

func CopyByte(s []byte) []byte

安全的复制切片

func CopyComplex64

func CopyComplex64(s []complex64) []complex64

安全的复制切片

func CopyComplex128

func CopyComplex128(s []complex128) []complex128

安全的复制切片

func CopyFloat32

func CopyFloat32(s []float32) []float32

安全的复制切片

func CopyFloat64

func CopyFloat64(s []float64) []float64

安全的复制切片

func CopyInt

func CopyInt(s []int) []int

安全的复制切片

func CopyInt8

func CopyInt8(s []int8) []int8

安全的复制切片

func CopyInt16

func CopyInt16(s []int16) []int16

安全的复制切片

func CopyInt32

func CopyInt32(s []int32) []int32

安全的复制切片

func CopyInt64

func CopyInt64(s []int64) []int64

安全的复制切片

func CopyRune

func CopyRune(s []rune) []rune

安全的复制切片

func CopyString

func CopyString(s []string) []string

安全的复制切片

func CopyUint

func CopyUint(s []uint) []uint

安全的复制切片

func CopyUint8

func CopyUint8(s []uint8) []uint8

安全的复制切片

func CopyUint16

func CopyUint16(s []uint16) []uint16

安全的复制切片

func CopyUint32

func CopyUint32(s []uint32) []uint32

安全的复制切片

func CopyUint64

func CopyUint64(s []uint64) []uint64

安全的复制切片

func CopyUintptr

func CopyUintptr(s []uintptr) []uintptr

安全的复制切片

func CopyUniqueString

func CopyUniqueString(s []unique.Handle[string]) []unique.Handle[string]

返回切片sli中是否包含单个元素v

func DeleteByElement

func DeleteByElement(s []interface{}, element interface{}, num ...int) []interface{}

返回将s中删除前n个元素e后的切片,如果num不填,或者num<0会删除所有子元素e

func DeleteByElementBool

func DeleteByElementBool(s []bool, element bool, num ...int) []bool

返回将s中删除前n个元素e后的切片,如果num不填,或者num<0会删除所有子元素e

func DeleteByElementByte

func DeleteByElementByte(s []byte, element byte, num ...int) []byte

返回将s中删除前n个元素e后的切片,如果num不填,或者num<0会删除所有子元素e

func DeleteByElementComplex64

func DeleteByElementComplex64(s []complex64, element complex64, num ...int) []complex64

返回将s中删除前n个元素e后的切片,如果num不填,或者num<0会删除所有子元素e

func DeleteByElementComplex128

func DeleteByElementComplex128(s []complex128, element complex128, num ...int) []complex128

返回将s中删除前n个元素e后的切片,如果num不填,或者num<0会删除所有子元素e

func DeleteByElementFloat32

func DeleteByElementFloat32(s []float32, element float32, num ...int) []float32

返回将s中删除前n个元素e后的切片,如果num不填,或者num<0会删除所有子元素e

func DeleteByElementFloat64

func DeleteByElementFloat64(s []float64, element float64, num ...int) []float64

返回将s中删除前n个元素e后的切片,如果num不填,或者num<0会删除所有子元素e

func DeleteByElementInt

func DeleteByElementInt(s []int, element int, num ...int) []int

返回将s中删除前n个元素e后的切片,如果num不填,或者num<0会删除所有子元素e

func DeleteByElementInt8

func DeleteByElementInt8(s []int8, element int8, num ...int) []int8

返回将s中删除前n个元素e后的切片,如果num不填,或者num<0会删除所有子元素e

func DeleteByElementInt16

func DeleteByElementInt16(s []int16, element int16, num ...int) []int16

返回将s中删除前n个元素e后的切片,如果num不填,或者num<0会删除所有子元素e

func DeleteByElementInt32

func DeleteByElementInt32(s []int32, element int32, num ...int) []int32

返回将s中删除前n个元素e后的切片,如果num不填,或者num<0会删除所有子元素e

func DeleteByElementInt64

func DeleteByElementInt64(s []int64, element int64, num ...int) []int64

返回将s中删除前n个元素e后的切片,如果num不填,或者num<0会删除所有子元素e

func DeleteByElementRune

func DeleteByElementRune(s []rune, element rune, num ...int) []rune

返回将s中删除前n个元素e后的切片,如果num不填,或者num<0会删除所有子元素e

func DeleteByElementString

func DeleteByElementString(s []string, element string, num ...int) []string

返回将s中删除前n个元素e后的切片,如果num不填,或者num<0会删除所有子元素e

func DeleteByElementUint

func DeleteByElementUint(s []uint, element uint, num ...int) []uint

返回将s中删除前n个元素e后的切片,如果num不填,或者num<0会删除所有子元素e

func DeleteByElementUint8

func DeleteByElementUint8(s []uint8, element uint8, num ...int) []uint8

返回将s中删除前n个元素e后的切片,如果num不填,或者num<0会删除所有子元素e

func DeleteByElementUint16

func DeleteByElementUint16(s []uint16, element uint16, num ...int) []uint16

返回将s中删除前n个元素e后的切片,如果num不填,或者num<0会删除所有子元素e

func DeleteByElementUint32

func DeleteByElementUint32(s []uint32, element uint32, num ...int) []uint32

返回将s中删除前n个元素e后的切片,如果num不填,或者num<0会删除所有子元素e

func DeleteByElementUint64

func DeleteByElementUint64(s []uint64, element uint64, num ...int) []uint64

返回将s中删除前n个元素e后的切片,如果num不填,或者num<0会删除所有子元素e

func DeleteByElementUintptr

func DeleteByElementUintptr(s []uintptr, element uintptr, num ...int) []uintptr

返回将s中删除前n个元素e后的切片,如果num不填,或者num<0会删除所有子元素e

func DeleteByElementUniqueString

func DeleteByElementUniqueString(s []unique.Handle[string], element unique.Handle[string], num ...int) []unique.Handle[string]

返回将s中删除前n个元素e后的切片,如果num不填,或者num<0会删除所有子元素e

func DeleteByIndex

func DeleteByIndex(s []interface{}, from int, to ...int) []interface{}

删除从位置是从from(包括)到to(不包括)的相关元素,如果to不填写,则表示只删除from这个位置的一个元素

func DeleteByIndexBool

func DeleteByIndexBool(s []bool, from int, to ...int) []bool

删除从位置是从from(包括)到to(不包括)的相关元素,如果to不填写,则表示只删除from这个位置的一个元素

func DeleteByIndexByte

func DeleteByIndexByte(s []byte, from int, to ...int) []byte

删除从位置是从from(包括)到to(不包括)的相关元素,如果to不填写,则表示只删除from这个位置的一个元素

func DeleteByIndexComplex64

func DeleteByIndexComplex64(s []complex64, from int, to ...int) []complex64

删除从位置是从from(包括)到to(不包括)的相关元素,如果to不填写,则表示只删除from这个位置的一个元素

func DeleteByIndexComplex128

func DeleteByIndexComplex128(s []complex128, from int, to ...int) []complex128

删除从位置是从from(包括)到to(不包括)的相关元素,如果to不填写,则表示只删除from这个位置的一个元素

func DeleteByIndexFloat32

func DeleteByIndexFloat32(s []float32, from int, to ...int) []float32

删除从位置是从from(包括)到to(不包括)的相关元素,如果to不填写,则表示只删除from这个位置的一个元素

func DeleteByIndexFloat64

func DeleteByIndexFloat64(s []float64, from int, to ...int) []float64

删除从位置是从from(包括)到to(不包括)的相关元素,如果to不填写,则表示只删除from这个位置的一个元素

func DeleteByIndexInt

func DeleteByIndexInt(s []int, from int, to ...int) []int

删除从位置是从from(包括)到to(不包括)的相关元素,如果to不填写,则表示只删除from这个位置的一个元素

func DeleteByIndexInt8

func DeleteByIndexInt8(s []int8, from int, to ...int) []int8

删除从位置是从from(包括)到to(不包括)的相关元素,如果to不填写,则表示只删除from这个位置的一个元素

func DeleteByIndexInt16

func DeleteByIndexInt16(s []int16, from int, to ...int) []int16

删除从位置是从from(包括)到to(不包括)的相关元素,如果to不填写,则表示只删除from这个位置的一个元素

func DeleteByIndexInt32

func DeleteByIndexInt32(s []int32, from int, to ...int) []int32

删除从位置是从from(包括)到to(不包括)的相关元素,如果to不填写,则表示只删除from这个位置的一个元素

func DeleteByIndexInt64

func DeleteByIndexInt64(s []int64, from int, to ...int) []int64

删除从位置是从from(包括)到to(不包括)的相关元素,如果to不填写,则表示只删除from这个位置的一个元素

func DeleteByIndexRune

func DeleteByIndexRune(s []rune, from int, to ...int) []rune

删除从位置是从from(包括)到to(不包括)的相关元素,如果to不填写,则表示只删除from这个位置的一个元素

func DeleteByIndexString

func DeleteByIndexString(s []string, from int, to ...int) []string

删除从位置是从from(包括)到to(不包括)的相关元素,如果to不填写,则表示只删除from这个位置的一个元素

func DeleteByIndexUint

func DeleteByIndexUint(s []uint, from int, to ...int) []uint

删除从位置是从from(包括)到to(不包括)的相关元素,如果to不填写,则表示只删除from这个位置的一个元素

func DeleteByIndexUint8

func DeleteByIndexUint8(s []uint8, from int, to ...int) []uint8

删除从位置是从from(包括)到to(不包括)的相关元素,如果to不填写,则表示只删除from这个位置的一个元素

func DeleteByIndexUint16

func DeleteByIndexUint16(s []uint16, from int, to ...int) []uint16

删除从位置是从from(包括)到to(不包括)的相关元素,如果to不填写,则表示只删除from这个位置的一个元素

func DeleteByIndexUint32

func DeleteByIndexUint32(s []uint32, from int, to ...int) []uint32

删除从位置是从from(包括)到to(不包括)的相关元素,如果to不填写,则表示只删除from这个位置的一个元素

func DeleteByIndexUint64

func DeleteByIndexUint64(s []uint64, from int, to ...int) []uint64

删除从位置是从from(包括)到to(不包括)的相关元素,如果to不填写,则表示只删除from这个位置的一个元素

func DeleteByIndexUintptr

func DeleteByIndexUintptr(s []uintptr, from int, to ...int) []uintptr

删除从位置是从from(包括)到to(不包括)的相关元素,如果to不填写,则表示只删除from这个位置的一个元素

func DeleteByIndexUniqueString

func DeleteByIndexUniqueString(s []unique.Handle[string], from int, to ...int) []unique.Handle[string]

删除从位置是从from(包括)到to(不包括)的相关元素,如果to不填写,则表示只删除from这个位置的一个元素

func Distinct

func Distinct(s []interface{}) []interface{}

返回去重复后的数据

func DistinctBool

func DistinctBool(s []bool) []bool

返回去重复后的数据

func DistinctByte

func DistinctByte(s []byte) []byte

返回去重复后的数据

func DistinctComplex64

func DistinctComplex64(s []complex64) []complex64

返回去重复后的数据

func DistinctComplex128

func DistinctComplex128(s []complex128) []complex128

返回去重复后的数据

func DistinctFloat32

func DistinctFloat32(s []float32) []float32

返回去重复后的数据

func DistinctFloat64

func DistinctFloat64(s []float64) []float64

返回去重复后的数据

func DistinctInt

func DistinctInt(s []int) []int

返回去重复后的数据

func DistinctInt8

func DistinctInt8(s []int8) []int8

返回去重复后的数据

func DistinctInt16

func DistinctInt16(s []int16) []int16

返回去重复后的数据

func DistinctInt32

func DistinctInt32(s []int32) []int32

返回去重复后的数据

func DistinctInt64

func DistinctInt64(s []int64) []int64

返回去重复后的数据

func DistinctRune

func DistinctRune(s []rune) []rune

返回去重复后的数据

func DistinctString

func DistinctString(s []string) []string

返回去重复后的数据

func DistinctUint

func DistinctUint(s []uint) []uint

返回去重复后的数据

func DistinctUint8

func DistinctUint8(s []uint8) []uint8

返回去重复后的数据

func DistinctUint16

func DistinctUint16(s []uint16) []uint16

返回去重复后的数据

func DistinctUint32

func DistinctUint32(s []uint32) []uint32

返回去重复后的数据

func DistinctUint64

func DistinctUint64(s []uint64) []uint64

返回去重复后的数据

func DistinctUintptr

func DistinctUintptr(s []uintptr) []uintptr

返回去重复后的数据

func DistinctUniqueString

func DistinctUniqueString(s []unique.Handle[string]) []unique.Handle[string]

返回去重复后的数据

func Filter

func Filter(from []interface{}, where func(interface{}) bool) (result []interface{})

切片筛选通用函数

//结构体

type Student struct {
	Name   string
	Age    int
	Height int
}

//样本数据

Students := []Student{
	Student{"Danny", 15, 165},
	Student{"Jacky", 16, 180},
	Student{"Alan", 17, 172},
	Student{"Sandy", 18, 168},
}

//循环匹配主函数

func Filter(from []Student, where func(Student) bool) (result []Student) {
	for _, line := range from {
		if where(line) {
			result = append(result, line)
		}
	}
	return result
}

//匹配条件函数

func Where() func(Student) bool {
	return func(s Student) bool {
		return (s.Age > 15) && (s.Height > 170)
	}
}

func InnerJoin

func InnerJoin(m, n []interface{}) []interface{}

返回去重复后两个切片的交集

func InnerJoinInt

func InnerJoinInt(m, n []int) []int

返回去重复后两个切片的交集

func InnerJoinInt8

func InnerJoinInt8(m, n []int8) []int8

返回去重复后两个切片的交集

func InnerJoinInt16

func InnerJoinInt16(m, n []int16) []int16

返回去重复后两个切片的交集

func InnerJoinInt32

func InnerJoinInt32(m, n []int32) []int32

返回去重复后两个切片的交集

func InnerJoinString

func InnerJoinString(m, n []string) []string

返回去重复后两个切片的交集

func InnerJoinUniqueString

func InnerJoinUniqueString(m, n []unique.Handle[string]) []unique.Handle[string]

返回去重复后两个切片的交集

func InsertIgnore

func InsertIgnore(s []interface{}, v interface{}) []interface{}

向切片Sli中插入没出现过的元素V,如果切片中有V,则不插入

func InsertIgnoreBool

func InsertIgnoreBool(s []bool, v bool) []bool

向切片Sli中插入没出现过的元素V,如果切片中有V,则不插入

func InsertIgnoreByte

func InsertIgnoreByte(s []byte, v byte) []byte

向切片Sli中插入没出现过的元素V,如果切片中有V,则不插入

func InsertIgnoreComplex64

func InsertIgnoreComplex64(s []complex64, v complex64) []complex64

向切片Sli中插入没出现过的元素V,如果切片中有V,则不插入

func InsertIgnoreComplex128

func InsertIgnoreComplex128(s []complex128, v complex128) []complex128

向切片Sli中插入没出现过的元素V,如果切片中有V,则不插入

func InsertIgnoreFloat32

func InsertIgnoreFloat32(s []float32, v float32) []float32

向切片Sli中插入没出现过的元素V,如果切片中有V,则不插入

func InsertIgnoreFloat64

func InsertIgnoreFloat64(s []float64, v float64) []float64

向切片Sli中插入没出现过的元素V,如果切片中有V,则不插入

func InsertIgnoreInt

func InsertIgnoreInt(s []int, v int) []int

向切片Sli中插入没出现过的元素V,如果切片中有V,则不插入

func InsertIgnoreInt8

func InsertIgnoreInt8(s []int8, v int8) []int8

向切片Sli中插入没出现过的元素V,如果切片中有V,则不插入

func InsertIgnoreInt16

func InsertIgnoreInt16(s []int16, v int16) []int16

向切片Sli中插入没出现过的元素V,如果切片中有V,则不插入

func InsertIgnoreInt32

func InsertIgnoreInt32(s []int32, v int32) []int32

向切片Sli中插入没出现过的元素V,如果切片中有V,则不插入

func InsertIgnoreInt64

func InsertIgnoreInt64(s []int64, v int64) []int64

向切片Sli中插入没出现过的元素V,如果切片中有V,则不插入

func InsertIgnoreRune

func InsertIgnoreRune(s []rune, v rune) []rune

向切片Sli中插入没出现过的元素V,如果切片中有V,则不插入

func InsertIgnoreString

func InsertIgnoreString(s []string, v string) []string

向切片Sli中插入没出现过的元素V,如果切片中有V,则不插入

func InsertIgnoreUint

func InsertIgnoreUint(s []uint, v uint) []uint

向切片Sli中插入没出现过的元素V,如果切片中有V,则不插入

func InsertIgnoreUint8

func InsertIgnoreUint8(s []uint8, v uint8) []uint8

向切片Sli中插入没出现过的元素V,如果切片中有V,则不插入

func InsertIgnoreUint16

func InsertIgnoreUint16(s []uint16, v uint16) []uint16

向切片Sli中插入没出现过的元素V,如果切片中有V,则不插入

func InsertIgnoreUint32

func InsertIgnoreUint32(s []uint32, v uint32) []uint32

向切片Sli中插入没出现过的元素V,如果切片中有V,则不插入

func InsertIgnoreUint64

func InsertIgnoreUint64(s []uint64, v uint64) []uint64

向切片Sli中插入没出现过的元素V,如果切片中有V,则不插入

func InsertIgnoreUintptr

func InsertIgnoreUintptr(s []uintptr, v uintptr) []uintptr

向切片Sli中插入没出现过的元素V,如果切片中有V,则不插入

func InsertIgnoreUniqueString

func InsertIgnoreUniqueString(s []unique.Handle[string], v unique.Handle[string]) []unique.Handle[string]

向切片Sli中插入没出现过的元素V,如果切片中有V,则不插入

func Left

func Left(s []interface{}, n int) []interface{}

返回从左往右最多n个元素

func LeftBool

func LeftBool(s []bool, n int) []bool

返回从左往右最多n个元素

func LeftByte

func LeftByte(s []byte, n int) []byte

返回从左往右最多n个元素

func LeftComplex64

func LeftComplex64(s []complex64, n int) []complex64

返回从左往右最多n个元素

func LeftComplex128

func LeftComplex128(s []complex128, n int) []complex128

返回从左往右最多n个元素

func LeftFloat32

func LeftFloat32(s []float32, n int) []float32

返回从左往右最多n个元素

func LeftFloat64

func LeftFloat64(s []float64, n int) []float64

返回从左往右最多n个元素

func LeftInt

func LeftInt(s []int, n int) []int

返回从左往右最多n个元素

func LeftInt8

func LeftInt8(s []int8, n int) []int8

返回从左往右最多n个元素

func LeftInt16

func LeftInt16(s []int16, n int) []int16

返回从左往右最多n个元素

func LeftInt32

func LeftInt32(s []int32, n int) []int32

返回从左往右最多n个元素

func LeftInt64

func LeftInt64(s []int64, n int) []int64

返回从左往右最多n个元素

func LeftRune

func LeftRune(s []rune, n int) []rune

返回从左往右最多n个元素

func LeftString

func LeftString(s []string, n int) []string

返回从左往右最多n个元素

func LeftUint

func LeftUint(s []uint, n int) []uint

返回从左往右最多n个元素

func LeftUint8

func LeftUint8(s []uint8, n int) []uint8

返回从左往右最多n个元素

func LeftUint16

func LeftUint16(s []uint16, n int) []uint16

返回从左往右最多n个元素

func LeftUint32

func LeftUint32(s []uint32, n int) []uint32

返回从左往右最多n个元素

func LeftUint64

func LeftUint64(s []uint64, n int) []uint64

返回从左往右最多n个元素

func LeftUintptr

func LeftUintptr(s []uintptr, n int) []uintptr

返回从左往右最多n个元素

func LeftUniqueString

func LeftUniqueString(s []unique.Handle[string], n int) []unique.Handle[string]

返回从左往右最多n个元素

func NotIn

func NotIn(m, n []interface{}) (mNotInN []interface{})

返回集合m不在集合n中的所有值,也即m-n,注意在此不对m做去重操作

func NotInBool

func NotInBool(m, n []bool) (mNotInN []bool)

返回集合m不在集合n中的所有值,也即m-n,注意在此不对m做去重操作

func NotInByte

func NotInByte(m, n []byte) (mNotInN []byte)

返回集合m不在集合n中的所有值,也即m-n,注意在此不对m做去重操作

func NotInComplex64

func NotInComplex64(m, n []complex64) (mNotInN []complex64)

返回集合m不在集合n中的所有值,也即m-n,注意在此不对m做去重操作

func NotInComplex128

func NotInComplex128(m, n []complex128) (mNotInN []complex128)

返回集合m不在集合n中的所有值,也即m-n,注意在此不对m做去重操作

func NotInFloat32

func NotInFloat32(m, n []float32) (mNotInN []float32)

返回集合m不在集合n中的所有值,也即m-n,注意在此不对m做去重操作

func NotInFloat64

func NotInFloat64(m, n []float64) (mNotInN []float64)

返回集合m不在集合n中的所有值,也即m-n,注意在此不对m做去重操作

func NotInInt

func NotInInt(m, n []int) (mNotInN []int)

返回集合m不在集合n中的所有值,也即m-n,注意在此不对m做去重操作

func NotInInt8

func NotInInt8(m, n []int8) (mNotInN []int8)

返回集合m不在集合n中的所有值,也即m-n,注意在此不对m做去重操作

func NotInInt16

func NotInInt16(m, n []int16) (mNotInN []int16)

返回集合m不在集合n中的所有值,也即m-n,注意在此不对m做去重操作

func NotInInt32

func NotInInt32(m, n []int32) (mNotInN []int32)

返回集合m不在集合n中的所有值,也即m-n,注意在此不对m做去重操作

func NotInInt64

func NotInInt64(m, n []int64) (mNotInN []int64)

返回集合m不在集合n中的所有值,也即m-n,注意在此不对m做去重操作

func NotInRune

func NotInRune(m, n []rune) (mNotInN []rune)

返回集合m不在集合n中的所有值,也即m-n,注意在此不对m做去重操作

func NotInString

func NotInString(m, n []string) (mNotInN []string)

返回集合m不在集合n中的所有值,也即m-n,注意在此不对m做去重操作

func NotInUint

func NotInUint(m, n []uint) (mNotInN []uint)

返回集合m不在集合n中的所有值,也即m-n,注意在此不对m做去重操作

func NotInUint8

func NotInUint8(m, n []uint8) (mNotInN []uint8)

返回集合m不在集合n中的所有值,也即m-n,注意在此不对m做去重操作

func NotInUint16

func NotInUint16(m, n []uint16) (mNotInN []uint16)

返回集合m不在集合n中的所有值,也即m-n,注意在此不对m做去重操作

func NotInUint32

func NotInUint32(m, n []uint32) (mNotInN []uint32)

返回集合m不在集合n中的所有值,也即m-n,注意在此不对m做去重操作

func NotInUint64

func NotInUint64(m, n []uint64) (mNotInN []uint64)

返回集合m不在集合n中的所有值,也即m-n,注意在此不对m做去重操作

func NotInUintptr

func NotInUintptr(m, n []uintptr) (mNotInN []uintptr)

返回集合m不在集合n中的所有值,也即m-n,注意在此不对m做去重操作

func NotInUniqueString

func NotInUniqueString(m, n []unique.Handle[string]) (mNotInN []unique.Handle[string])

返回集合m不在集合n中的所有值,也即m-n,注意在此不对m做去重操作

func ReSethashAlgorithmSwitchNum

func ReSethashAlgorithmSwitchNum(n int)

重置hashAlgorithmSwitchNum

func Reverse

func Reverse(s []interface{})

对切片进行倒序排列

func ReverseBool

func ReverseBool(s []bool)

对切片进行倒序排列

func ReverseByte

func ReverseByte(s []byte)

对切片进行倒序排列

func ReverseComplex64

func ReverseComplex64(s []complex64)

对切片进行倒序排列

func ReverseComplex128

func ReverseComplex128(s []complex128)

对切片进行倒序排列

func ReverseFloat32

func ReverseFloat32(s []float32)

对切片进行倒序排列

func ReverseFloat64

func ReverseFloat64(s []float64)

对切片进行倒序排列

func ReverseInt

func ReverseInt(s []int)

对切片进行倒序排列

func ReverseInt8

func ReverseInt8(s []int8)

对切片进行倒序排列

func ReverseInt16

func ReverseInt16(s []int16)

对切片进行倒序排列

func ReverseInt32

func ReverseInt32(s []int32)

对切片进行倒序排列

func ReverseInt64

func ReverseInt64(s []int64)

对切片进行倒序排列

func ReverseRune

func ReverseRune(s []rune)

对切片进行倒序排列

func ReverseString

func ReverseString(s []string)

对切片进行倒序排列

func ReverseUint

func ReverseUint(s []uint)

对切片进行倒序排列

func ReverseUint8

func ReverseUint8(s []uint8)

对切片进行倒序排列

func ReverseUint16

func ReverseUint16(s []uint16)

对切片进行倒序排列

func ReverseUint32

func ReverseUint32(s []uint32)

对切片进行倒序排列

func ReverseUint64

func ReverseUint64(s []uint64)

对切片进行倒序排列

func ReverseUintptr

func ReverseUintptr(s []uintptr)

对切片进行倒序排列

func ReverseUniqueString

func ReverseUniqueString(s []unique.Handle[string])

对切片进行倒序排列

func Right(s []interface{}, n int) []interface{}

返回右往左最多n个元素

func RightBool

func RightBool(s []bool, n int) []bool

返回右往左最多n个元素

func RightByte

func RightByte(s []byte, n int) []byte

返回右往左最多n个元素

func RightComplex64

func RightComplex64(s []complex64, n int) []complex64

返回右往左最多n个元素

func RightComplex128

func RightComplex128(s []complex128, n int) []complex128

返回右往左最多n个元素

func RightFloat32

func RightFloat32(s []float32, n int) []float32

返回右往左最多n个元素

func RightFloat64

func RightFloat64(s []float64, n int) []float64

返回右往左最多n个元素

func RightInt

func RightInt(s []int, n int) []int

返回右往左最多n个元素

func RightInt8

func RightInt8(s []int8, n int) []int8

返回右往左最多n个元素

func RightInt16

func RightInt16(s []int16, n int) []int16

返回右往左最多n个元素

func RightInt32

func RightInt32(s []int32, n int) []int32

返回右往左最多n个元素

func RightInt64

func RightInt64(s []int64, n int) []int64

返回右往左最多n个元素

func RightRune

func RightRune(s []rune, n int) []rune

返回右往左最多n个元素

func RightString

func RightString(s []string, n int) []string

返回右往左最多n个元素

func RightUint

func RightUint(s []uint, n int) []uint

返回右往左最多n个元素

func RightUint8

func RightUint8(s []uint8, n int) []uint8

返回右往左最多n个元素

func RightUint16

func RightUint16(s []uint16, n int) []uint16

返回右往左最多n个元素

func RightUint32

func RightUint32(s []uint32, n int) []uint32

返回右往左最多n个元素

func RightUint64

func RightUint64(s []uint64, n int) []uint64

返回右往左最多n个元素

func RightUintptr

func RightUintptr(s []uintptr, n int) []uintptr

返回右往左最多n个元素

func RightUniqueString

func RightUniqueString(s []unique.Handle[string], n int) []unique.Handle[string]

返回右往左最多n个元素

func Shuffling

func Shuffling(s []interface{})

https://github.com/golang/go/wiki/SliceTricks

go官方的案例如下,注意一定要先执行rand.Seed(time.Now().UnixNano())

for i := len(a) - 1; i > 0; i-- {
    j := rand.Intn(i + 1)
    a[i], a[j] = a[j], a[i]
}

返回随机打乱后的切片

func ShufflingBool

func ShufflingBool(s []bool)

返回切片s中是否包含单个元素v

func ShufflingByte

func ShufflingByte(s []byte)

返回切片s中是否包含单个元素v

func ShufflingComplex64

func ShufflingComplex64(s []complex64)

返回切片s中是否包含单个元素v

func ShufflingComplex128

func ShufflingComplex128(s []complex128)

返回切片s中是否包含单个元素v

func ShufflingFloat32

func ShufflingFloat32(s []float32)

返回切片s中是否包含单个元素v

func ShufflingFloat64

func ShufflingFloat64(s []float64)

返回切片s中是否包含单个元素v

func ShufflingInt

func ShufflingInt(s []int)

返回切片s中是否包含单个元素v

func ShufflingInt8

func ShufflingInt8(s []int8)

返回切片s中是否包含单个元素v

func ShufflingInt16

func ShufflingInt16(s []int16)

返回切片s中是否包含单个元素v

func ShufflingInt32

func ShufflingInt32(s []int32)

返回切片s中是否包含单个元素v

func ShufflingInt64

func ShufflingInt64(s []int64)

返回切片s中是否包含单个元素v

func ShufflingRune

func ShufflingRune(s []rune)

返回切片s中是否包含单个元素v

func ShufflingString

func ShufflingString(s []string)

返回随机打乱后的切片

func ShufflingUinqueString

func ShufflingUinqueString(s []unique.Handle[string])

返回随机打乱后的切片

func ShufflingUint

func ShufflingUint(s []uint)

返回切片s中是否包含单个元素v

func ShufflingUint8

func ShufflingUint8(s []uint8)

返回切片s中是否包含单个元素v

func ShufflingUint16

func ShufflingUint16(s []uint16)

返回切片s中是否包含单个元素v

func ShufflingUint32

func ShufflingUint32(s []uint32)

返回切片s中是否包含单个元素v

func ShufflingUint64

func ShufflingUint64(s []uint64)

返回切片s中是否包含单个元素v

func ShufflingUintptr

func ShufflingUintptr(s []uintptr)

返回切片s中是否包含单个元素v

func SortByte

func SortByte(s []byte)

切片排序

func SortFloat32

func SortFloat32(s []float32)

切片排序

func SortFloat64

func SortFloat64(s []float64)

切片排序

func SortInt

func SortInt(s []int)

切片排序

func SortInt8

func SortInt8(s []int8)

切片排序

func SortInt16

func SortInt16(s []int16)

切片排序

func SortInt32

func SortInt32(s []int32)

切片排序

func SortInt64

func SortInt64(s []int64)

切片排序

func SortRune

func SortRune(s []rune)

切片排序

func SortString

func SortString(s []string)
func Sort(s []interface{}) []interface{} {
	sort.Slice(s, func(i, j int) bool {
		return s[i] < s[j]
	})
	return s
}

切片排序

func SortUint

func SortUint(s []uint)

切片排序

func SortUint8

func SortUint8(s []uint8)

切片排序

func SortUint16

func SortUint16(s []uint16)

切片排序

func SortUint32

func SortUint32(s []uint32)

切片排序

func SortUint64

func SortUint64(s []uint64)

切片排序

func SortUintptr

func SortUintptr(s []uintptr)

切片排序

func SortUniqueString

func SortUniqueString(s []unique.Handle[string])

//切片排序

func SortBool(s []bool) {
	sort.Slice(s, func(i, j int) bool {
		return s[i] < s[j]
	})
}

切片排序

func Union

func Union(m, n []interface{}) []interface{}

获得两个切片去重后的合集,也即m+n,注意union 与 union all的区别,这里并不实现union all

func UnionBool

func UnionBool(m, n []bool) []bool

获得两个切片去重后的合集,也即m+n,注意union 与 union all的区别,这里并不实现union all

func UnionByte

func UnionByte(m, n []byte) []byte

获得两个切片去重后的合集,也即m+n,注意union 与 union all的区别,这里并不实现union all

func UnionComplex64

func UnionComplex64(m, n []complex64) []complex64

获得两个切片去重后的合集,也即m+n,注意union 与 union all的区别,这里并不实现union all

func UnionComplex128

func UnionComplex128(m, n []complex128) []complex128

获得两个切片去重后的合集,也即m+n,注意union 与 union all的区别,这里并不实现union all

func UnionFloat32

func UnionFloat32(m, n []float32) []float32

获得两个切片去重后的合集,也即m+n,注意union 与 union all的区别,这里并不实现union all

func UnionFloat64

func UnionFloat64(m, n []float64) []float64

获得两个切片去重后的合集,也即m+n,注意union 与 union all的区别,这里并不实现union all

func UnionInt

func UnionInt(m, n []int) []int

获得两个切片去重后的合集,也即m+n,注意union 与 union all的区别,这里并不实现union all

func UnionInt8

func UnionInt8(m, n []int8) []int8

获得两个切片去重后的合集,也即m+n,注意union 与 union all的区别,这里并不实现union all

func UnionInt16

func UnionInt16(m, n []int16) []int16

获得两个切片去重后的合集,也即m+n,注意union 与 union all的区别,这里并不实现union all

func UnionInt32

func UnionInt32(m, n []int32) []int32

获得两个切片去重后的合集,也即m+n,注意union 与 union all的区别,这里并不实现union all

func UnionInt64

func UnionInt64(m, n []int64) []int64

获得两个切片去重后的合集,也即m+n,注意union 与 union all的区别,这里并不实现union all

func UnionRune

func UnionRune(m, n []rune) []rune

获得两个切片去重后的合集,也即m+n,注意union 与 union all的区别,这里并不实现union all

func UnionString

func UnionString(m, n []string) []string

获得两个切片去重后的合集,也即m+n,注意union 与 union all的区别,这里并不实现union all

func UnionUint

func UnionUint(m, n []uint) []uint

获得两个切片去重后的合集,也即m+n,注意union 与 union all的区别,这里并不实现union all

func UnionUint8

func UnionUint8(m, n []uint8) []uint8

获得两个切片去重后的合集,也即m+n,注意union 与 union all的区别,这里并不实现union all

func UnionUint16

func UnionUint16(m, n []uint16) []uint16

获得两个切片去重后的合集,也即m+n,注意union 与 union all的区别,这里并不实现union all

func UnionUint32

func UnionUint32(m, n []uint32) []uint32

获得两个切片去重后的合集,也即m+n,注意union 与 union all的区别,这里并不实现union all

func UnionUint64

func UnionUint64(m, n []uint64) []uint64

获得两个切片去重后的合集,也即m+n,注意union 与 union all的区别,这里并不实现union all

func UnionUintptr

func UnionUintptr(m, n []uintptr) []uintptr

获得两个切片去重后的合集,也即m+n,注意union 与 union all的区别,这里并不实现union all

func UnionUniqueString

func UnionUniqueString(m, n []unique.Handle[string]) []unique.Handle[string]

获得两个切片去重后的合集,也即m+n,注意union 与 union all的区别,这里并不实现union all

Types

This section is empty.

Jump to

Keyboard shortcuts

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