num2text

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 25, 2023 License: MIT Imports: 4 Imported by: 0

README

num2text

Golang library to convert number to text in different ways

Use it if you want to convert number to text, ordinal, or full ordinal.

Numbers to Text

num2text.ConvertToText(1)    // one
num2text.ConvertToText(2)    // two
num2text.ConvertToText(999)  // nine hundred ninety nine

Numbers to Ordinal

num2text.ConvertToOrdinal(1)    // 1st
num2text.ConvertToOrdinal(2)    // 2nd
num2text.ConvertToOrdinal(999)  // 999th

Numbers to Ordinal with Full description

num2text.ConvertToOrdinalFull(1)    // first
num2text.ConvertToOrdinalFull(2)    // second
num2text.ConvertToOrdinalFull(999)  // nine hundred ninety nine thousand nine hundred ninety nineth
num2text.ConvertToOrdinalFull(55)   // fifty fifth
num2text.ConvertToOrdinalFull(105)  // one hundred fifth

Text to Number convertion

num2text.ConvertToNumber("ten thousand twelfth") // 10012
num2text.ConvertToNumber("ten thousand twelve") // 10012
num2text.ConvertToNumber("10012th") // 10012

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToNumber

func ConvertToNumber(numWord string) int

func ConvertToOrdinal

func ConvertToOrdinal(num int) string

func ConvertToOrdinalFull

func ConvertToOrdinalFull(number int) string

ConvertToOrdinalFull A function that converts a number to an ordinal in full form

func ConvertToText

func ConvertToText(num int) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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