Documentation
¶
Index ¶
- Variables
- func Atoi16(s string) (int16, error)
- func Atoi32(s string) (int32, error)
- func Atoi8(s string) (int8, error)
- func AtoiLang(lang, s string) (int, error)
- func AtoiMore(s, comma, decimal string) (int, error)
- func AtoiOrDefault(s string, def int) int
- func CanonicalIntStringOrIgnore(s, comma, decimal string) string
- func ChangeToFunnelPct(v float64) float64
- func ChangeToXoXPct(v float64) float64
- func Commify(n int64) string
- func DecimalSeparator(lang string) (string, error)
- func FormatDecimal[N constraints.Float | constraints.Integer](v N, precision int) string
- func FormatFloat64Simple(v float64) string
- func FormatFloat64ToAnyString(v float64, pattern string) string
- func FormatFloat64ToAnyStringFunnel(v float64, pattern string) string
- func FormatFloat64ToIntString(v float64) string
- func FormatFloat64ToIntStringFunnel(v float64) string
- func Int64Abbreviation(val int64) string
- func Int64Len(val int64) int
- func Itoa[E constraints.Integer](e E) string
- func MustParseBool(s string) bool
- func MustParseE164ToInt(s string) int
- func MustParseInt(s string) int
- func SliceAtoi(strings []string) ([]int, error)
- func SliceAtoiSort(strings []string) ([]int, error)
- func SliceItoa(ints []int) []string
- func ThousandsSeparator(lang string) (string, error)
- type Float64ToString
- type Int64ToString
Constants ¶
This section is empty.
Variables ¶
var RxPlus = regexp.MustCompile(`^\+`)
Functions ¶
func AtoiLang ¶
AtoiLang provides language parsing to handle thousands separators. Number formats: https://docs.oracle.com/cd/E19455-01/806-0169/overview-9/index.html
func AtoiOrDefault ¶
AtoiOrDefault is like Atoi but takes a default value which it returns in the event of a parse error.
func CanonicalIntStringOrIgnore ¶ added in v0.39.0
func ChangeToFunnelPct ¶
ChangeToFunnelPct converts a 1.0 == 100% based `float64` to a Funnel percentage `float64`.
func ChangeToXoXPct ¶
ChangeToXoXPct converts a 1.0 == 100% based `float64` to a XoX percentage `float64`.
func DecimalSeparator ¶
func FormatDecimal ¶ added in v0.42.0
func FormatDecimal[N constraints.Float | constraints.Integer](v N, precision int) string
func FormatFloat64Simple ¶ added in v0.38.4
func FormatFloat64ToAnyString ¶
FormatFloat64ToAnyString is used for XoX growth.
func FormatFloat64ToAnyStringFunnel ¶
FormatFloat64ToAnyStringFunnel is used for funnels.
func Int64Abbreviation ¶
Int64Abbreviation returns integer abbreviations. For example, "1.5K", "15K", "150K", "1.5M", "15M", "150M".
func Itoa ¶ added in v0.50.0
func Itoa[E constraints.Integer](e E) string
Itoa is like `strconv.Itoa()` with the additional functionality of converting `uint64` and accepting integer types natively via `constraints.Integer`.
func MustParseBool ¶
func MustParseE164ToInt ¶
func MustParseInt ¶
func SliceAtoiSort ¶
SliceAtoiSort converts and sorts a slice of string integers.
func ThousandsSeparator ¶
Types ¶
type Float64ToString ¶
Float64ToString is a function type to define functions.
type Int64ToString ¶
Int64ToString is a function type to define functions.