utils

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateLevenshteinDistance

func CalculateLevenshteinDistance(a, b string) int

CalculateLevenshteinDistance measures the similarity between the two given strings.

func FallbackStr

func FallbackStr(val, fallback string) string

FallbackStr returns the fallback if the given val is empty otherwise returns the normalized val

func FatalIf

func FatalIf(err error)

FatalIf will panic if the given error is not nil

func Min

func Min(vals ...int) int

Min determines the minimum among the provided values

func NormalizeString

func NormalizeString(str string) string

NormalizeString normalizes the provided string to remove spaces and be lowercase

func PrintTable

func PrintTable(data [][]string, opts TableOpts)

PrintTable prints the given table in a formatted table.

Types

type TableOpts

type TableOpts struct {
	Headers []string
	Caption string
}

TableOpts defines options for the table writer

Jump to

Keyboard shortcuts

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