uniq

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2021 License: MIT Imports: 0 Imported by: 0

README

go uniq

make slice items unique in go

install

go get github.com/dariubs/uniq

example

package main

import (
	"fmt"

	"github.com/dariubs/uniq"
)

func main() {
	wstring := []string{"hello", "hello", "holla", "hello", "hi", "holla", "hi"}
	wuniq := uniq.UniqString(wstring)
	fmt.Printf("%v\n", wuniq) // [hello holla hi]

	xint := []int{1, 2, 2, 3, 4, 5, 5, 5, 6, 6, 7}
	xuniq := uniq.UniqInt(xint)
	fmt.Printf("%v\n", xuniq) // [1 2 3 4 5 6 7]

	yuint := []uint{1, 2, 2, 3, 4, 5, 5, 5, 6, 6, 7}
	yuniq := uniq.UniqUint(yuint)
	fmt.Printf("%v\n", yuniq) // [1 2 3 4 5 6 7]
}

by

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UniqInt

func UniqInt(list []int) []int

func UniqString

func UniqString(list []string) []string

func UniqUint

func UniqUint(list []uint) []uint

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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