number

package
v0.0.0-...-9d0e06d Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddThousandToInt

func AddThousandToInt(number int) string

addThousandToInt add the Thousand separator to int value and returns a string with Thousand added

func CalcPercentage

func CalcPercentage(total, value interface{}, precision int) float64

CalcPercentage calcula o percentual do primeiro parametro em relacao ao segundo(total)

func FloatToIntMoney

func FloatToIntMoney(v float64) (r int)

FloatToIntMoney converte um float em inteiro com 2 casas decimais

func GetDecimalPart

func GetDecimalPart(value float64) (r string)

GetDecimalPart retorna a parte decimal de um float, retornando em formato string

func GetFormattedFloat

func GetFormattedFloat(v float64) string

GetFormattedFloat retorma um float formatado

func GetFormattedMoneyBRL

func GetFormattedMoneyBRL(v float64, precision int) string

GetFormattedMoneyBRL retorna um float formatado em dinheiro brasileiro

func GetFormattedMoneyBRLWithNoPrefix

func GetFormattedMoneyBRLWithNoPrefix(v float64, precision int) string

GetFormattedMoneyBRLWithNoPrefix retorna um float formatado em dinheiro brasileiro sem o prefixo R$

func GetFormattedMoneyUSD

func GetFormattedMoneyUSD(v float64, precision int) string

func GetNotZeroFloatValue

func GetNotZeroFloatValue(p ...float64) float64

GetNotZeroFloatValue dado um array de valores float64, é retornado o que tem valor maior que zero

func GetValorMonetarioPorExtenso

func GetValorMonetarioPorExtenso(v float64) string

GetValorMonetarioPorExtenso retorna uma string contendo o significado monetario por extenso do valor informado

func IsIntegral

func IsIntegral(value float64) bool

IsIntegral Verifica se o valor informado é fracionado ou não

func Max

func Max[T constraints.Ordered](values ...T) (r T)

Max return the maximum value given variadic argument

func Min

func Min[T constraints.Ordered](values ...T) (r T)

Min return the maximum value given variadic argument

func MinMax

func MinMax[T constraints.Ordered](min bool, values ...T) (r T)

MinMax return the min or max given variadic argument

func Percentage

func Percentage(value, percentage interface{}, precision int) float64

Percentage retorna o resultado do calculo percentual com base no percentual, valor e precisao informados

func PointerToFInt16

func PointerToFInt16(v *int16) int16

func PointerToFInt32

func PointerToFInt32(v *int32) int32

func PointerToFloat32

func PointerToFloat32(v *float32) float32

func PointerToFloat64

func PointerToFloat64(v *float64) float64

func PointerToInt

func PointerToInt(v *int) int

func PreciseNumber

func PreciseNumber(value interface{}, precision int) (result float64)

PreciseNumber retorna o numero informado convertido para a precisao em casas decimais desejada

func RoundFloat

func RoundFloat(v float64, precision int) float64

RoundFloat returns float value with precision passed by parameter

func StringToFloat

func StringToFloat(val string) float64

StringToFloat Converte uma string suspostamente com valor de float para o tipo float

func StringToInt

func StringToInt(val string) int

StringToInt convert string type into int type, return zero value if conversion has a error

func ToFloat32

func ToFloat32(i interface{}, decimals int) float32

func ToFloat64

func ToFloat64(i interface{}, decimals int) float64

ToFloat64 converte strings and other primite types to Float64, returns 0(Zero) if the parameter passed is not a valid float64

func ToFloat64Pointer

func ToFloat64Pointer(i interface{}, decimals int) *float64

ToFloat64 converte strings and other primite types to Float64, returns 0(Zero) if the parameter passed is not a valid float64

func ToInt

func ToInt(val interface{}) int

ToInt convert interface to int, if val is not a valid int value, zero will be returned

func ToInt32

func ToInt32(val interface{}) int32

ToInt convert interface to int32, if val is not a valid int32 value, zero will be returned

func ToInt64

func ToInt64(val interface{}) int64

func ToUint16

func ToUint16(v interface{}) uint16

Types

type Currency

type Currency string
const (
	CurrencyBRL         Currency = "BRL"
	CurrencyBRLNoPrefix Currency = "BRL_NOPREFIX"
	CurrencyUSD         Currency = "USD"
)

Jump to

Keyboard shortcuts

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