go_utils

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2020 License: MIT Imports: 12 Imported by: 1

README

go_utils

golang is great! But there're some common features I'd like to be less verbose. Here lies my attempt at that.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayToString

func ArrayToString(arr []int) string

func ContainsString

func ContainsString(arr []string, searchStr string) bool

func ContainsStringFast

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

func ContainsSubtringFast

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

func DupArray

func DupArray(array []int) []int

func DupStrArray

func DupStrArray(array []string) []string

func ExecuteCommand

func ExecuteCommand(command string, doWait bool) int

func ExecuteCommandAndGetResults

func ExecuteCommandAndGetResults(command string) (string, error)

func FileExists

func FileExists(filename string) bool

func FindIndex

func FindIndex(arr []string, searchStr string) int

func FindIndexFast

func FindIndexFast(ss []string, s string) int

func FindLongest

func FindLongest(arr []string) int

func FindWithRegex

func FindWithRegex(arr []string, regex_s string) []string

func GenerateSubsequences

func GenerateSubsequences(inputSequence []int) map[string][]int

func GetFileSize

func GetFileSize(path string) int64

func GetFloat

func GetFloat() float64

func GetInt

func GetInt() int

func GetKeys

func GetKeys(hash map[string]interface{}) []string

func GetLine

func GetLine() string

func GetString

func GetString() string

func HumanReadableSize

func HumanReadableSize(size int64) string

func InsertIntoSortedListIfNotThereAlready

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

func Join

func Join(arr []string, delim string) string

Normal join includes the separator at the end, which is dumb

func JoinAndSurround

func JoinAndSurround(arr []string, delim string, surrounding string) string

func LastElement

func LastElement(arr []string) string

func MapToArray

func MapToArray(hash map[string]bool) []string

func Max

func Max(a int, b int) int

func Min

func Min(a int, b int) int

func Mod

func Mod(x, d int) int

Positive modulo, returns non negative solution to x % d

func MoveFile

func MoveFile(oldLocation, newLocation string) error

func PrintArray

func PrintArray(arr []int)

func PrintArray2D

func PrintArray2D(data [][]int)

func ReadChar

func ReadChar(prompt string, interfaces ...interface{}) (string, error)

func Readline

func Readline(prompt string, interfaces ...interface{}) (string, error)

TODO: this might... just be wrong

func RemoveArrayElement

func RemoveArrayElement(arr []int, i int) []int

func RemoveEmpty

func RemoveEmpty(arr []string) []string

func RemoveStringArrayElement

func RemoveStringArrayElement(arr []string, i int) []string

func RemoveStringArrayElementIfExists

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

func ScanArray

func ScanArray(size int) []int

func ScanArray2D

func ScanArray2D(A, B int) [][]int

func SortByLength

func SortByLength(arr []string) []string

func StringArrayToString

func StringArrayToString(arr []string) string

func Timer

func Timer(fn func(), description string, iterations int)

#region Timer

Types

This section is empty.

Jump to

Keyboard shortcuts

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