u_go

package module
v0.0.0-...-040aaa0 Latest Latest
Warning

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

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

README

u.go

Introduction

u.go is a data structure and algorithm library for go.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Filter

func Filter[T any](slice []T, fn func(T) bool) []T

Filter returns all the elements from the collection which satisfies the conditional logic of callback function

func FilterMap

func FilterMap[K comparable, V any](m map[K]V, fn func(V) bool) map[K]V

FilterMap iterates over the elements of a collection and returns a new collection representing all the items which satisfies the criteria formulated in the callback function

func Find

func Find[T constraints.Ordered](s []T, elem T) int

Find returns the index of the first found element

func FindAll

func FindAll[T any](s []T, fn func(T) bool) map[int]T

FindAll returns a map whose key is the index of the element that meets the criteria and value is the element that meets the criteria

func FindBy

func FindBy[T any](s []T, fn func(T) bool) int

FindBy returns the index of the first found element

func IsAlnum

func IsAlnum(ch byte) bool

IsAlnum checks if ch character is alphanumeric

func IsAlpha

func IsAlpha(ch byte) bool

IsAlpha checks if ch character is alphabetic

func IsBlank

func IsBlank(ch byte) bool

IsBlank checks if ch character is blank character

func IsCntrl

func IsCntrl(ch byte) bool

IsCntrl checks if ch character is control character

func IsDigit

func IsDigit(ch byte) bool

IsDigit checks if ch character is digit

func IsGraph

func IsGraph(ch byte) bool

IsGraph checks if ch character is graphical character

func IsLower

func IsLower(ch byte) bool

IsLower checks if ch character is lowercase character

func IsPrint

func IsPrint(ch byte) bool

IsPrint checks if ch character is printing character

func IsPunct

func IsPunct(ch byte) bool

IsPunct checks if ch character is punctuation character

func IsSpace

func IsSpace(ch byte) bool

IsSpace checks if ch character is space character

func IsUpper

func IsUpper(ch byte) bool

IsUpper checks if ch character is uppercase character

func IsXdigit

func IsXdigit(ch byte) bool

IsXdigit checks if ch character is hexadecimal character

func Keys

func Keys[K comparable, V any](m map[K]V) []K

Keys retrieve all the existing keys of a map

func Map

func Map[T any](slice []T, fn func(T) T)

Map maps an element to another value

func MapBy

func MapBy[T any](slice []T, fn func(*T))

MapBy maps an element to another value

func Max

func Max[T constraints.Ordered](s []T) int

Max returns the index of the maximum value in slice

func MaxBy

func MaxBy[T any](s []T, fn func(T, T) int) int

MaxBy returns the index of the maximum value in slice fn first element greater than the second element returns 1, equality returns 0, and less than -1

func Min

func Min[T constraints.Ordered](s []T) int

Min returns the index of the minimum value in slice

func MinBy

func MinBy[T any](s []T, fn func(T, T) int) int

MinBy finds the minimum value of a slice fn first element greater than the second element returns 1, equality returns 0, and less than -1

func ToLower

func ToLower(ch byte) byte

ToLower converts a character to lowercase

func ToUpper

func ToUpper(ch byte) byte

ToUpper converts a character to uppercase

func Values

func Values[K comparable, V any](m map[K]V) []V

Values retrieve all the existing values of a map

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