stringutil

package module
v0.0.0-...-8446e34 Latest Latest
Warning

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

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

README

stringutil Go Reference

Some Go string utilities

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Sort = sort.Strings

Sort is a convenience alias so you don't have to import package sort.

Functions

func Clear

func Clear(obj Object)

func EqSet

func EqSet(a, b Set) bool

func EqSlice

func EqSlice(a, b Slice) bool

func First

func First(ss ...string) string

First returns the first non-blank string.

func HasBlank

func HasBlank(ss ...string) bool

HasBlank returns true if any string is blank.

func In

func In(s string, ss []string) bool

In returns true if an equal string is in the slice.

func InBitField

func InBitField(s string, m *CharBitField) bool

func InRange

func InRange(s string, m *CharMap) bool

func Last

func Last(ss ...string) string

Last returns the last non-blank string.

func Purge

func Purge(m Set)

func Remove

func Remove(m Set, ss Slice)

func Zero

func Zero(m Set)

Types

type CharBitField

type CharBitField = [256 / 8]byte

CharBitField is a bit field for testing character ranges. It is not as fast as CharMap, but it is 8 times smaller if that's important for some reason.

func MakeCharBitField

func MakeCharBitField(s string) *CharBitField

type CharMap

type CharMap = [256]bool

CharMap is an array for use in mapping from byte to bool and testing whether the characters of string are in range.

func MakeCharMap

func MakeCharMap(s string) *CharMap

type MultiObject

type MultiObject = map[string][]string

func Merge

func Merge(dst, a, b MultiObject) MultiObject

func ToMultiObject

func ToMultiObject(obj Object) MultiObject

type Object

type Object = map[string]string

func ToObject

func ToObject(m MultiObject) Object

type Set

type Set = map[string]bool

func Clone

func Clone(m Set) Set

func DiffSets

func DiffSets(oldSet, newSet Set) (added Set)

func SymDiffSets

func SymDiffSets(oldSet, newSet Set) (added, removed Set)

func ToSet

func ToSet(ss Slice) Set

func Update

func Update(m Set, ss Slice) Set

type Slice

type Slice = []string

func Append

func Append(dst Slice, m Set) Slice

func Copy

func Copy(ss Slice) Slice

func SymDiff

func SymDiff(oldss, newss Slice) (added, removed Slice)

func ToSlice

func ToSlice(m Set) Slice

func Unique

func Unique(dst, ss Slice) Slice

func UniqueVia

func UniqueVia(dst, ss Slice, m Set) Slice

Jump to

Keyboard shortcuts

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