count

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2020 License: BSL-1.0 Imports: 1 Imported by: 0

README

Count Package

GoDoc Go Report Card

About

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

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

Count 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)

Count 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/count"
)

func main() {
	marks := []bool{true,true,false}
	fmt.Println("Number of true marks:", count.Bool(marks,true))
}

Output:

Number of true marks: 2

Using Git

Clone the master branch and all refs of this project:

$ git clone https://github.com/vbsw/count.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 count provides the "count" 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, value bool) int

Bool returns count of value in list.

func Byte

func Byte(list []byte, value byte) int

Byte returns count of value in list.

func Complex64

func Complex64(list []complex64, value complex64) int

Complex64 returns count of value in list.

func Complex128

func Complex128(list []complex128, value complex128) int

Complex128 returns count of value in list.

func Error

func Error(list []error, value error) int

Error returns count of value in list.

func Float32

func Float32(list []float32, value float32) int

Float32 returns count of value in list.

func Float64

func Float64(list []float64, value float64) int

Float64 returns count of value in list.

func Int

func Int(list []int, value int) int

Int returns count of value in list.

func Int8

func Int8(list []int8, value int8) int

Int8 returns count of value in list.

func Int16

func Int16(list []int16, value int16) int

Int16 returns count of value in list.

func Int32

func Int32(list []int32, value int32) int

Int32 returns count of value in list.

func Int64

func Int64(list []int64, value int64) int

Int64 returns count of value in list.

func Interface

func Interface(list []interface{}, value interface{}) int

Interface returns count of value in list.

func Pointer

func Pointer(list []unsafe.Pointer, value unsafe.Pointer) int

Pointer returns count of value in list.

func Rune

func Rune(list []rune, value rune) int

Rune returns count of value in list.

func String

func String(list []string, value string) int

String returns count of value in list.

func UInt

func UInt(list []uint, value uint) int

UInt returns count of value in list.

func UInt8

func UInt8(list []uint8, value uint8) int

UInt8 returns count of value in list.

func UInt16

func UInt16(list []uint16, value uint16) int

UInt16 returns count of value in list.

func UInt32

func UInt32(list []uint32, value uint32) int

UInt32 returns count of value in list.

func UInt64

func UInt64(list []uint64, value uint64) int

UInt64 returns count of value in list.

Types

This section is empty.

Jump to

Keyboard shortcuts

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