contains

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2018 License: BSL-1.0 Imports: 1 Imported by: 0

README

Contains Package

GoDoc report card

About

This package provides the function "contains" for slices of basic types. It is published on https://github.com/vbsw/contains.

Copyright 2018, Vitali Baumtrok (vbsw@mailbox.org).

Contains Package is distributed under the Boost Software License, version 1.0. (See accompanying file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt)

Contains Package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Boost Software License for more details.

Example

Source Code:

package main

import (
	"fmt"
	"github.com/vbsw/contains"
)

func main() {
	names := []String{"Alice","Bob","Claire","Dave"}

	if contains.String(names,"Bob") {
		fmt.Println("Contains the name Bob.")
	}
}

Output:

Contains the name Bob.

Using Git

Clone the master branch and all refs of this project:

$ git clone https://github.com/vbsw/contains.git

See all tags:

$ git tag -l

See local and remote branches:

$ git branch -a

Check out other branches than master, for example the development branch:

$ git branch development origin/development
$ git checkout development

See tracked remote branches:

$ git branch -vv

Update all tracked branches and all refs:

$ git fetch

References

Documentation

Overview

Package contains provides the "contains" function for slices of basic types.

Version 1.0.0.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(list []bool, key bool) bool

Bool returns true, if list contains key.

func Byte

func Byte(list []byte, key byte) bool

Byte returns true, if list contains key.

func Complex128

func Complex128(list []complex128, key complex128) bool

Complex128 returns true, if list contains key.

func Complex64

func Complex64(list []complex64, key complex64) bool

Complex64 returns true, if list contains key.

func Error

func Error(list []error, key error) bool

Error returns true, if list contains key.

func Float32

func Float32(list []float32, key float32) bool

Float32 returns true, if list contains key.

func Float64

func Float64(list []float64, key float64) bool

Float64 returns true, if list contains key.

func Int

func Int(list []int, key int) bool

Int returns true, if list contains key.

func Int16

func Int16(list []int16, key int16) bool

Int16 returns true, if list contains key.

func Int32

func Int32(list []int32, key int32) bool

Int32 returns true, if list contains key.

func Int64

func Int64(list []int64, key int64) bool

Int64 returns true, if list contains key.

func Int8

func Int8(list []int8, key int8) bool

Int8 returns true, if list contains key.

func Interface

func Interface(list []interface{}, key interface{}) bool

Interface returns true, if list contains key.

func Pointer

func Pointer(list []unsafe.Pointer, key unsafe.Pointer) bool

Pointer returns true, if list contains key.

func Rune

func Rune(list []rune, key rune) bool

Rune returns true, if list contains key.

func String

func String(list []string, key string) bool

String returns true, if list contains key.

func UInt

func UInt(list []uint, key uint) bool

UInt returns true, if list contains key.

func UInt16

func UInt16(list []uint16, key uint16) bool

UInt16 returns true, if list contains key.

func UInt32

func UInt32(list []uint32, key uint32) bool

UInt32 returns true, if list contains key.

func UInt64

func UInt64(list []uint64, key uint64) bool

UInt64 returns true, if list contains key.

func UInt8

func UInt8(list []uint8, key uint8) bool

UInt8 returns true, if list contains key.

Types

This section is empty.

Jump to

Keyboard shortcuts

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