utils

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2021 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BasicWordWrap added in v0.0.5

func BasicWordWrap(input string, maxChars int) (output string)

basic word wrapping utility method

func CeilF2I

func CeilF2I(v float64) int

Round the given floating point number to the nearest larger integer and return that as an integer.

func ClampF added in v0.0.4

func ClampF(value, min, max float64) float64

Returns the `value` given unless it's smaller than `min` or greater than `max`. If it's less than `min`, `min` is returned and if it's greater than `max` it returns max.

func ClampI

func ClampI(value, min, max int) int

Returns the `value` given unless it's smaller than `min` or greater than `max`. If it's less than `min`, `min` is returned and if it's greater than `max` it returns max.

func CleanCRLF

func CleanCRLF(s string) string

func DistInts

func DistInts(max int, in []int) (out []int)

func Distribute

func Distribute(total, available, parts, nChildren, spacing int) (values, gaps []int, err error)

func EqInts added in v0.0.4

func EqInts(a, b []int) (same bool)

func FileWritable

func FileWritable(path string) (writable bool)

func FloorI

func FloorI(v, min int) int

Returns the `value` given unless it's less than `min`, in which case it returns `min`.

func HasBit

func HasBit(v, b uint64) bool

func HasSpace

func HasSpace(text string) bool

func IsDir

func IsDir(path string) (found bool)

func IsEmpty

func IsEmpty(text string) bool

func IsFalse

func IsFalse(text string) bool

func IsFile

func IsFile(path string) (found bool)

func IsTrue

func IsTrue(text string) bool

func IsUrl added in v0.0.5

func IsUrl(str string) (isUrl bool)

func LexicographicLess

func LexicographicLess(i, j string) bool

func MakeDir

func MakeDir(path string, perm os.FileMode) error

func NLSprintf

func NLSprintf(format string, argv ...interface{}) string

func PadLeft

func PadLeft(src, pad string, length int) string

func PadRight

func PadRight(src, pad string, length int) string

func ReadFile added in v0.0.4

func ReadFile(path string) (content string, err error)

func RotateSlice added in v0.0.4

func RotateSlice(a []interface{}, rotation int) (rotated []interface{})

func SolveSpaceAlloc

func SolveSpaceAlloc(nChildren, nSpace, minSpacing int) (increment int, gaps []int)

func StringSliceHasValue added in v0.0.5

func StringSliceHasValue(slice []string, value string) (has bool)

func StripTags added in v0.0.5

func StripTags(input string) (output string)

func SumInts

func SumInts(ints []int) (sum int)

Add the given list of integers up and return the result.

Types

This section is empty.

Jump to

Keyboard shortcuts

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