fmtx

package
v3.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

fmtx - a package with some formatting helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Number

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

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

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

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

func NumeralP0(number float64) string

NumeralP0 is a wrapper around FormatNumberNumeral with 0 precision.

Usage:

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

func NumeralP1

func NumeralP1(number float64) string

NumeralP1 is a wrapper around FormatNumberNumeral with 1 precision.

Usage:

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

Types

This section is empty.

Jump to

Keyboard shortcuts

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