Documentation ¶
Overview ¶
Package ru converts numbers, currencies to russian words.
Index ¶
- Variables
- func CurrencyFloat64(amount float64, o ...CurrencyOpt) (words string, err error)
- func CurrencyInt64(amount int64, o ...CurrencyOpt) (words string, err error)
- func CurrencyString(amount string, o ...CurrencyOpt) (words string, err error)
- func Float64(decimal float64, options ...OptFunc) (result string, err error)
- func Int64(number int64, options ...OptFunc) (string, error)
- func MustFloat64(decimal float64, options ...OptFunc) string
- func MustInt64(number int64, options ...OptFunc) string
- func MustString(decimal string, options ...OptFunc) string
- func String(decimal string, options ...OptFunc) (result string, err error)
- type CurrencyOpt
- type CurrencyOptions
- type Declination
- type OptFunc
- type Options
Constants ¶
This section is empty.
Variables ¶
View Source
var ( FormatDefault = []OptFunc{ WithFmtGender(gender.Female), WithParseSep('.'), WithParseFracLen(0), WithFmtFracIgnore(false), WithFmtFracUseDigits(false), } )
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 MustFloat64 ¶
func MustString ¶
Types ¶
type CurrencyOpt ¶
type CurrencyOpt func(o *CurrencyOptions)
func ParseCurrencyOpts ¶
func ParseCurrencyOpts(options ...interface{}) []CurrencyOpt
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 WithFmtFracIgnore ¶
WithFmtFracIgnore sets fractional part hiding flag. Default value is false.
func WithFmtFracUseDigits ¶
WithFmtFracUseDigits sets using digits in fractional part. Default value is false.
func WithFmtGender ¶
WithFmtGender set gender. Default value is gender.Female.
func WithParseFracLen ¶
WithParseFracLen sets fractional part parsing length. Default value is 0.
func WithParseSep ¶
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.
Опции перевода чисел в слова для русского языка.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.