number

package
v0.0.0-...-3f39334 Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecimalDigits

func DecimalDigits[T constraints.Integer](num T) int

func FloatToString

func FloatToString[T constraints.Float](n T, precision int) string

func IntToString

func IntToString[T constraints.Integer](n T) string

func NumToAccountingString

func NumToAccountingString[T Num](f T, precision int) string

NumToAccountingString converts a number to an accounting string. Caution: This is an example, in practical some countries may have different accounting format.

func StringToFloat

func StringToFloat[T constraints.Float](s string) (T, error)

func StringToInt

func StringToInt[T constraints.Integer](s string) (T, error)

Types

type Num

type Num interface {
	constraints.Integer | constraints.Float
}

Jump to

Keyboard shortcuts

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