Documentation
¶
Overview ¶
Package num2words implements numbers to words converter.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Convert ¶
Convert converts number into the words representation.
Example ¶
fmt.Println(num2words.Convert(11)) fmt.Println(num2words.Convert(123)) fmt.Println(num2words.Convert(-99))
Output: eleven one hundred twenty-three minus ninety-nine
func ConvertAnd ¶
ConvertAnd converts number into the words representation with " and " added between number groups.
Example ¶
fmt.Println(num2words.ConvertAnd(123)) fmt.Println(num2words.ConvertAnd(514))
Output: one hundred and twenty-three five hundred and fourteen
func ConvertFloat ¶ added in v1.0.1
ConvertFloat converts float number into words representation. precision controls decimal places (-1 for automatic precision)
Example ¶
fmt.Println(num2words.ConvertFloat(123.45, 2)) fmt.Println(num2words.ConvertFloat(-0.42, 2)) fmt.Println(num2words.ConvertFloat(1.50, num2words.AutoPrecision))
Output: one hundred twenty-three point forty-five minus zero point forty-two one point five
func ConvertFloatAnd ¶ added in v1.0.1
ConvertFloatAnd converts float number into words representation with " and " added between number groups. precision controls decimal places (-1 for automatic precision)
Example ¶
fmt.Println(num2words.ConvertFloatAnd(123.45, 2)) fmt.Println(num2words.ConvertFloatAnd(1234.5678, 4))
Output: one hundred and twenty-three point forty-five one thousand two hundred and thirty-four point five thousand six hundred and seventy-eight
Types ¶
Click to show internal directories.
Click to hide internal directories.