numeroaletras

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: MIT Imports: 4 Imported by: 1

README

Numero a Letras en Go

Una librería en Go para convertir números a su representación en letras en español, basada en php-numero-a-letras de Luis Cano.

Características

  • Convierte números enteros y decimales a letras.
  • Soporta formatos monetarios.
  • Fácil de usar e integrar en proyectos Go.

Instalación

go get -u github.com/user0608/numeroaletras

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsZero

func IsZero(s string) bool

Types

type NumeroALetras

type NumeroALetras struct {
	Conector string
	// contains filtered or unexported fields
}

NumeroALetras is a struct that provides methods to convert numbers to their Spanish word representations.

func NewNumeroALetras

func NewNumeroALetras() *NumeroALetras

NewNumeroALetras initializes and returns a new instance of NumeroALetras with default values.

func (*NumeroALetras) ToInvoice

func (n *NumeroALetras) ToInvoice(number float64, decimals int, currency string) (string, error)

ToInvoice converts a number to its invoice representation in words. number: The number to be converted. decimals: The number of decimal places to consider. Default is 2. currency: The currency to append at the end.

func (*NumeroALetras) ToMoney

func (n *NumeroALetras) ToMoney(number float64, decimals int, currency, cents string) (string, error)

ToMoney converts a numeric value to its money representation in words. number: The numeric value to be converted. decimals: The number of decimal places to consider. Default is 2. currency: The currency to append to the whole number part. cents: The currency to append to the decimal part.

func (*NumeroALetras) ToString

func (n *NumeroALetras) ToString(number float64, decimals int, wholeStr, decimalStr string) (string, error)

ToString converts a number to its string representation with specified whole and decimal strings. number: The number to be converted. decimals: The number of decimal places to include. wholeStr: The string to use for the whole number part. decimalStr: The string to use for the decimal part.

func (*NumeroALetras) ToWords

func (n *NumeroALetras) ToWords(number float64, decimals int) (string, error)

ToWords converts a numeric value to its word representation. number: The number to be converted. decimals: The number of decimal places to consider. Default is 2.

func (*NumeroALetras) UseApocope

func (n *NumeroALetras) UseApocope(value bool)

checkApocope modifies the 'unidades' array if Apocope is set to true.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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