extendutil

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2023 License: BSD-3-Clause Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs added in v0.2.3

func Abs[T PositiveNegativeNumeral](a T) T

func AppendWithUniqueItem

func AppendWithUniqueItem[T Comparable](srcArray []T, items ...T) (result []T)

func Equal

func Equal[T Comparable](a []T, b []T) bool

func ExtractFirstCaptureData

func ExtractFirstCaptureData(src []byte, toFind string) (ret []byte, ok bool)

func GetCaptureBytes

func GetCaptureBytes(data []byte, submatchIndexs []int, index int) (result []byte)

func GetFirstCharOfString added in v0.2.4

func GetFirstCharOfString(src string) (result string, size int)

func GetGroupIndexPair

func GetGroupIndexPair(index int) (groupBegin, groupEnd int)

func GetUniqueValueArray

func GetUniqueValueArray[T Comparable](valueArray []T) []T

func GetUniqueValueArrayExcludingACertain

func GetUniqueValueArrayExcludingACertain[T Comparable](valueArray []T, certain T) []T

func InterfaceIsNil

func InterfaceIsNil(i interface{}) bool

func IsInSlice

func IsInSlice[T Comparable](srcArray []T, item T) bool

检测给定数据项是否在指定Slice中

func JoinBytes

func JoinBytes(sep []byte, pBytes ...[]byte) []byte

func Max

func Max[T IntegerComparable](a, b T) T

func MergeMap

func MergeMap[T Comparable](src map[T]interface{}, others ...map[T]interface{}) map[T]interface{}

func MergeStringMap

func MergeStringMap(src map[string]interface{}, others ...map[string]interface{}) map[string]interface{}

func Min

func Min[T IntegerComparable](a, b T) T

func Reverse

func Reverse(slice interface{})

func ToInt

func ToInt(value interface{}) (int, bool)

func ToString

func ToString(value interface{}) (string, bool)

Types

type Comparable

type Comparable interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr |
		float32 | ~float64 | ~complex64 | ~complex128 |
		string
}

type IntegerComparable

type IntegerComparable interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
}

type PositiveNegativeNumeral added in v0.2.3

type PositiveNegativeNumeral interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64 | float32 | ~float64
}

Jump to

Keyboard shortcuts

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