stringset

package
v0.0.0-...-2ce84b7 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAndDelete

func AddAndDelete(arr []string, toDelete, toAdd string) []string

AddAndDelete 利用 Set 对 arr 进行添加和删除操作,返回排序结果。 适用于类似于重命名的情形。

func UniqueSort

func UniqueSort(arr []string) (result []string)

UniqueSort 利用 Set 对 arr 进行除重和排序。

Types

type Set

type Set struct {
	Map map[string]bool
}

Set .

func From

func From(arr []string) *Set

func Intersect

func Intersect(group []*Set) *Set

Intersect 取 group 里全部集合的交集。

func NewSet

func NewSet() *Set

func (*Set) Add

func (set *Set) Add(item string)

Add .

func (*Set) Delete

func (set *Set) Delete(item string)

Delete .

func (*Set) Has

func (set *Set) Has(item string) bool

Has .

func (*Set) Intersect

func (set *Set) Intersect(other *Set) *Set

Intersect .

func (*Set) Slice

func (set *Set) Slice() (arr []string)

Slice convert the set to a string slice.

Jump to

Keyboard shortcuts

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