text

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurrencyString

func CurrencyString[T Number](value T) string

CurrencyString formats as following: 10.00 -> $10, 10.50 -> $10.50, 10.55 -> $10.55, 10.556 -> $10.55

func CustomDecimalString

func CustomDecimalString[T Number](value T, precision int32, showThousandsSeparator bool) string

CustomDecimalString formats value given 2 precision as following: 10.00 -> 10, 10.50 -> 10.50, 10.55 -> 10.55, 10.556 -> 10.55 If showThousandsSeparator is true, it will add thousands separator as following: 1000000.00 -> 1,000,000

func DecimalString

func DecimalString[T Number](value T) string

DecimalString formats as following: 10.00 -> 10, 10.50 -> 10.50, 10.55 -> 10.55, 10.556 -> 10.55

func ToDecimal

func ToDecimal[T Number](value T) (decimal.Decimal, error)

Types

type Number

type Number interface {
	constraints.Integer | constraints.Float | ~string
}

Jump to

Keyboard shortcuts

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