sliceop

package module
v0.0.0-...-0c87fca Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2016 License: BSD-3-Clause Imports: 0 Imported by: 0

README

sliceop

Golang []string operations: Prefill, Map, Includes, NotIncludes, Select, Reject

Works well in combination with https://github.com/linkosmos/mapop

Build Status Coverage Status GoDoc Go Report Card BSD License

Methods
  • Prefill(size int, symbol string) (output []string)
  • Map(f func(input string) string, input ...string) (output []string)
  • Includes(input []string, key string) bool
  • NotIncludes(input []string, key string) bool
  • Reject(input []string, toReject ...string) (output []string)
  • Select(input []string, toSelect ...string) (output []string)
  • Unique(input ...string) (output []string)
  • Intersection(u1, u2 []string) (output []string)
  • CountFunc(f func(input string) bool, input ...string) (sum int)
  • Compact(input ...string) (output []string)
License

Copyright (c) 2015, linkosmos All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the name of sliceop nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compact

func Compact(input ...string) (output []string)

Compact - removes empty values from given array

func CountFunc

func CountFunc(f func(input string) bool, input ...string) (sum int)

CountFunc - counts the number of elements yielding a true value.

func Includes

func Includes(input []string, key string) bool

Includes - whether key includes array

func Intersection

func Intersection(u1, u2 []string) (output []string)

Intersection - finds matching values of both input types

func Map

func Map(f func(input string) string, input ...string) (output []string)

Map - maps array of strings with func

func NotIncludes

func NotIncludes(input []string, key string) bool

NotIncludes - whether key is not included in array

func Prefill

func Prefill(size int, symbol string) (output []string)

Prefill - prefil array with values

func Reject

func Reject(input []string, toReject ...string) (output []string)

Reject - reject specified keys

func Select

func Select(input []string, toSelect ...string) (output []string)

Select - select and return specified keys

func Unique

func Unique(input ...string) (output []string)

Unique - returns unique values for given input

Types

This section is empty.

Jump to

Keyboard shortcuts

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