utils

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MinInt

func MinInt(a int, b int) int

MinInt 获取最小int

func RuneFromIndex

func RuneFromIndex(w []rune, i int) string

RuneFromIndex 从i截取字符串

func RuneInIndex

func RuneInIndex(w []rune, i int) string

RuneInIndex 获取i位置字符串

func RuneInRange

func RuneInRange(w []rune, from int, to int) string

RuneInRange 从from到to截取字符串

func StringFromIndex

func StringFromIndex(str string, i int) string

StringFromIndex 从i截取字符串

func StringInIndex

func StringInIndex(str string, i int) string

StringInIndex 获取i位置字符串

func StringInRange

func StringInRange(str string, from int, to int) string

StringInRange 从from到to截取字符串

func StringInSlice

func StringInSlice(arr []string, i int) string

StringInSlice 获取[]string中i位置字符串

func StringSliceInRange

func StringSliceInRange(arr []string, from int, to int) []string

StringSliceInRange 获取[]string中from-to位置字符串

func StringSplit

func StringSplit(str string) []string

StringSplit []rune转[]string

Types

type OrderedStringCounter

type OrderedStringCounter struct {
	// contains filtered or unexported fields
}

OrderedStringCounter 统计str重复次数

func NewOrderedStringCounter

func NewOrderedStringCounter(strs []string) *OrderedStringCounter

NewOrderedStringCounter init OrderedStringCounter instance

func (*OrderedStringCounter) Add

func (s *OrderedStringCounter) Add(strs []string)

Add add strings to counter

func (*OrderedStringCounter) Count

func (s *OrderedStringCounter) Count(str string) int

Count get the counter of a string

func (*OrderedStringCounter) Exists

func (s *OrderedStringCounter) Exists(str string) bool

Exists check string exists in counter items or not

func (*OrderedStringCounter) Items

func (*OrderedStringCounter) Sum

func (s *OrderedStringCounter) Sum() int

Sum sum the total count of the items

func (*OrderedStringCounter) Total

func (s *OrderedStringCounter) Total() int

Total total number of the items

type StringCounter

type StringCounter struct {
	// contains filtered or unexported fields
}

StringCounter 统计str重复次数

func NewStringCounter

func NewStringCounter(strs []string) *StringCounter

NewStringCounter init StringCounter instance

func (*StringCounter) Add

func (s *StringCounter) Add(strs []string)

Add add strings to counter

func (*StringCounter) Count

func (s *StringCounter) Count(str string) int

Count get the counter of a string

func (*StringCounter) Del

func (s *StringCounter) Del(strs []string)

Del delete strings from counter items

func (*StringCounter) Exists

func (s *StringCounter) Exists(str string) bool

Exists check string exists in counter items or not

func (*StringCounter) Iter

func (s *StringCounter) Iter() <-chan StringCounterItem

Iter iterate StringCounter items

func (*StringCounter) Sum

func (s *StringCounter) Sum() int

Sum sum the total count of the items

func (*StringCounter) Total

func (s *StringCounter) Total() int

Total total number of the items

type StringCounterItem

type StringCounterItem struct {
	Key   string
	Value int
}

StringCounterItem used in Iter

type StringCounterItemSlice

type StringCounterItemSlice []StringCounterItem

StringCounterItemSlice StringCounterItem array

func NewStringCounterItemSlice

func NewStringCounterItemSlice(cap int) StringCounterItemSlice

NewStringCounterItemSlice 新建StringCounterItemSlice

func (StringCounterItemSlice) Len

func (s StringCounterItemSlice) Len() int

Len implement sort.Sorter

func (StringCounterItemSlice) Less

func (s StringCounterItemSlice) Less(i, j int) bool

Less implement sort.Sorter

func (StringCounterItemSlice) Swap

func (s StringCounterItemSlice) Swap(i, j int)

Swap implement sort.Sorter

type StringSet

type StringSet struct {
	// contains filtered or unexported fields
}

StringSet 线程安全string set

func InitStringSet

func InitStringSet() StringSet

func NewStringSet

func NewStringSet() *StringSet

NewStringSet init StringSet instance

func (*StringSet) Add

func (s *StringSet) Add(strs []string)

Add add strings to StringSet

func (*StringSet) Del

func (s *StringSet) Del(strs []string)

Del delete strings from StringSet

func (*StringSet) Exists

func (s *StringSet) Exists(str string) bool

Exists check str exists in StringSet items or not

func (*StringSet) Iter

func (s *StringSet) Iter() <-chan string

Iter StringSet items iter

func (*StringSet) Total

func (s *StringSet) Total() int

Total total number of StringSet items

Jump to

Keyboard shortcuts

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