Documentation ¶
Index ¶
- Variables
- func Compact(arr []interface{}) []interface{}
- func Contains(search interface{}, target interface{}) bool
- func ContainsIgnoreCase(search string, target []string) bool
- func CopyShallowMap(m map[string]string) map[string]string
- func Difference(a, b []string) (diff []string)
- func Equal(a, b interface{}) bool
- func Flatten(arr []interface{}) []interface{}
- func InInt64Array(target int64, int64Array []int64) bool
- func InIntArray(target int, intArray []int) bool
- func InStringArray(target string, strArray []string) bool
- func JoinInts(list []int64) string
- func Map(arr []interface{}, f MapFunc) []interface{}
- func RemoveDuplicate(slice []string) []string
- func ReverseStringSlice(slice []string) []string
- func SpliteInts(s string) ([]int64, error)
- func StringArrayEqual(arr1, arr2 []int) bool
- func ToSlice(arr interface{}) []interface{}
- func UniqueString(stringSlice []string) []string
- type ConcurrentMap
- type ConcurrentMapShared
- type MapFunc
- type Stringer
Constants ¶
This section is empty.
Variables ¶
var SHARD_COUNT = 32
Functions ¶
func Contains ¶
func Contains(search interface{}, target interface{}) bool
Contains 判断某个元素是否在slice, array, map中
func ContainsIgnoreCase ¶
ContainsIgnoreCase check if a string (search) is present in a slice of strings (target) regardless of the case. words := []string{"Apple", "Banana", "Cherry", "Date", "Fig", "Grape"}
fmt.Println(ContainsIgnoreCase("apple", words)) // true fmt.Println(ContainsIgnoreCase("BANANA", words)) // true fmt.Println(ContainsIgnoreCase("Cherry", words)) // true fmt.Println(ContainsIgnoreCase("date", words)) // true fmt.Println(ContainsIgnoreCase("fig", words)) // true fmt.Println(ContainsIgnoreCase("grape", words)) // true fmt.Println(ContainsIgnoreCase("kiwi", words)) // false
func CopyShallowMap ¶
CopyShallowMap makes a shallow copy of a map
func Difference ¶
Difference returns the difference between two string slices
func Equal ¶
func Equal(a, b interface{}) bool
Equal reports whether a and b are deeply equal. Map keys are always compared with ==, not deeply. (This matters for keys containing pointers or interfaces)
func Flatten ¶
func Flatten(arr []interface{}) []interface{}
Flatten 返回一个新的一维平面数组 Returns a new array that is one-dimensional flat. Example:
var arr1 = []interface{}{1, 2, 3, 4} // [1, 2, 3, 4] var arr2 = []interface{}{5, 6, 7, arr1} // [5, 6, 7, [1, 2, 3, 4]] result := arrays.Flatten(arr2) // [5, 6, 7, 1, 2, 3, 4]
func InInt64Array ¶
*
- @name: InInt64Array
- @descripttion: 是否在Int64列表中
- @param {string} target
- @param {[]string} strArray
- @return {bool}
func InIntArray ¶
*
- @name: InIntArray
- @descripttion: 是否在Int列表中
- @param {string} target
- @param {[]string} strArray
- @return {bool}
func InStringArray ¶
*
- @name: InStringArray
- @descripttion: 是否在字符串列表中
- @param {string} target
- @param {[]string} strArray
- @return {bool}
func RemoveDuplicate ¶
RemoveDuplicate 删除[]string 中的重复元素
func ReverseStringSlice ¶
ReverseStringSlice 反转字符串切片 [site user info 0 ] -> [0 info user site]
func SpliteInts ¶
SpliteInts split string into int64 slice.
func StringArrayEqual ¶
*
- @name: IntArrayEqual
- @descripttion: 判断IntArray是否相等
- @param {[]int} arr1
- @param {[]int} arr2
- @return {bool}
func UniqueString ¶
UniqueString returns a unique string from a slice
Types ¶
type ConcurrentMap ¶
type ConcurrentMap[K comparable, V any] struct { // contains filtered or unexported fields }
A "thread" safe map of type string:Anything To avoid lock bottlenecks this map is dived to severel (SHARD_COUNT) map shards
type ConcurrentMapShared ¶
type ConcurrentMapShared[K comparable, V any] struct { // contains filtered or unexported fields }
A "thread“ safe string to anything map
type Stringer ¶
type Stringer interface { fmt.Stringer comparable }