strconvutil

package
v0.30.15 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RxPlus = regexp.MustCompile(`^\+`)

Functions

func AtoiLang added in v0.30.0

func AtoiLang(lang, s string) (int, error)

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 added in v0.0.2

func AtoiOrDefault(s string, def int) int

AtoiOrDefault is like Atoi but takes a default value which it returns in the event of a parse error.

func ChangeToFunnelPct

func ChangeToFunnelPct(v float64) float64

ChangeToFunnelPct converts a 1.0 == 100% based `float64` to a Funnel percentage `float64`.

func ChangeToXoXPct

func ChangeToXoXPct(v float64) float64

ChangeToXoXPct converts a 1.0 == 100% based `float64` to a XoX percentage `float64`.

func Commify

func Commify(n int64) string

Commify takes an int64 and adds comma for every thousand Stack Overflow: http://stackoverflow.com/users/1705598/icza URL: http://stackoverflow.com/questions/13020308/how-to-fmt-printf-an-integer-with-thousands-comma

func DecimalSeparator added in v0.30.0

func DecimalSeparator(lang string) (string, error)

func FormatFloat64ToAnyString

func FormatFloat64ToAnyString(v float64, pattern string) string

FormatFloat64ToAnyString is used for XoX growth.

func FormatFloat64ToAnyStringFunnel

func FormatFloat64ToAnyStringFunnel(v float64, pattern string) string

FormatFloat64ToAnyStringFunnel is used for funnels.

func FormatFloat64ToIntString

func FormatFloat64ToIntString(v float64) string

func FormatFloat64ToIntStringFunnel

func FormatFloat64ToIntStringFunnel(v float64) string

func Int64Abbreviation

func Int64Abbreviation(val int64) string

Int64Abbreviation returns integer abbreviations. For example, "1.5K", "15K", "150K", "1.5M", "15M", "150M".

func Int64Len

func Int64Len(val int64) int

Int64Len returns the length of an Int64 number.

func MustParseBool

func MustParseBool(s string) bool

func MustParseE164ToInt

func MustParseE164ToInt(s string) int

func MustParseInt

func MustParseInt(s string) int

func SliceAtoi added in v0.0.12

func SliceAtoi(strings []string) ([]int, error)

SliceAtoi converts a slice of string integers.

func SliceAtoiSort added in v0.0.12

func SliceAtoiSort(strings []string) ([]int, error)

SliceAtoiSort converts and sorts a slice of string integers.

func SliceItoa added in v0.0.12

func SliceItoa(ints []int) []string

func ThousandsSeparator added in v0.30.0

func ThousandsSeparator(lang string) (string, error)

Types

type Float64ToString

type Float64ToString func(float64) string

Float64ToString is a function type to define functions.

type Int64ToString

type Int64ToString func(int64) string

Int64ToString is a function type to define functions.

Jump to

Keyboard shortcuts

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