ru

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package ru converts numbers, currencies to russian words.

Index

Constants

This section is empty.

Variables

Functions

func CurrencyFloat64

func CurrencyFloat64(amount float64, o ...CurrencyOpt) (words string, err error)

func CurrencyInt64

func CurrencyInt64(amount int64, o ...CurrencyOpt) (words string, err error)

func CurrencyString

func CurrencyString(amount string, o ...CurrencyOpt) (words string, err error)

func Float64

func Float64(decimal float64, options ...OptFunc) (result string, err error)

func Int64

func Int64(number int64, options ...OptFunc) (string, error)

func MustFloat64

func MustFloat64(decimal float64, options ...OptFunc) string

func MustInt64

func MustInt64(number int64, options ...OptFunc) string

func MustString

func MustString(decimal string, options ...OptFunc) string

func String

func String(decimal string, options ...OptFunc) (result string, err error)

Types

type CurrencyOpt

type CurrencyOpt func(o *CurrencyOptions)

func ParseCurrencyOpts

func ParseCurrencyOpts(options ...interface{}) []CurrencyOpt

func WithCur

func WithCur(c cur.Currency) CurrencyOpt

WithCur sets cur.Currency

func WithCurConvMU

func WithCurConvMU(convert bool) CurrencyOpt

WithCurConvMU sets flog to convert minor units to words.

func WithCurIgnoreMU

func WithCurIgnoreMU(ignore bool) CurrencyOpt

WithCurIgnoreMU sets flog to ignore minor units.

type CurrencyOptions

type CurrencyOptions struct {
	// contains filtered or unexported fields
}

type Declination

type Declination int
const (
	DeclinationPlural Declination = iota
	DeclinationSingular
	Declination234
)

type OptFunc

type OptFunc func(o *Options)

func ParseOpts

func ParseOpts(options ...interface{}) []OptFunc

func WithFmtFracIgnore

func WithFmtFracIgnore(ignore bool) OptFunc

WithFmtFracIgnore sets fractional part hiding flag. Default value is false.

func WithFmtFracUseDigits

func WithFmtFracUseDigits(useDigits bool) OptFunc

WithFmtFracUseDigits sets using digits in fractional part. Default value is false.

func WithFmtGender

func WithFmtGender(g gender.Gender) OptFunc

WithFmtGender set gender. Default value is gender.Female.

func WithParseFracLen

func WithParseFracLen(fracLen uint) OptFunc

WithParseFracLen sets fractional part parsing length. Default value is 0.

func WithParseSep

func WithParseSep(separator rune) OptFunc

WithParseSep sets decimal separator. Default value is point ('.').

type Options

type Options struct {
	// Decimal separator for parsing.
	// Десятичный разделитель целой и дробной части. По умолчанию '.'. Используется при парсинге числа из строки.
	ParseSeparator rune
	// Размер дробной части. По умолчанию 0.
	ParseFracLen uint
	// Род. По умолчанию женский.
	FmtGender gender.Gender
	// Не учитывать дробную часть числа. По умолчанию учитывается.
	FmtFracIgnore bool
	// Использовать числа вместо слов в дробной части. По умолчанию используются слова.
	FmtFracUseDigits bool
}

Options for russian language.

Опции перевода чисел в слова для русского языка.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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