Skip to content
On this page

Index

func Number

go
func Number(number float64, precision int, prefix, suffix string) string

Number returns a string representation of the given number in specified format.

Usage:

fmtx.Number(12345.456, 0, "$", "") // "$12,345"

func NumberP0

go
func NumberP0(number float64) string

NumberP0 is a wrapper around FormatNumber with 0 precision and no prefix or suffix.

Usage:

fmtx.NumberP0(12345.456) // "12,345"

func NumberP1

go
func NumberP1(number float64) string

NumberP1 is a wrapper around FormatNumber with 1 precision and no prefix or suffix.

Usage:

fmtx.NumberP1(12345.456) // "12,345.4"

func Numeral

go
func Numeral(number float64, precision int) string

Numeral returns a shorten, string representation of the given number.

Usage:

fmtx.Numeral(12345.456, 0) // "12k"

func NumeralP0

go
func NumeralP0(number float64) string

NumeralP0 is a wrapper around FormatNumberNumeral with 0 precision.

Usage:

fmtx.NumeralP0(12345.456) // "12k"

func NumeralP1

go
func NumeralP1(number float64) string

NumeralP1 is a wrapper around FormatNumberNumeral with 1 precision.

Usage:

fmtx.NumeralP1(12345.456) // "12.3k"

Generated by gomarkdoc