Number To Words

by verillious

7

📜 Number To Words

Made with Godot Pulse Checks

Convert numbers to words in GDScript

Check out year of our lord for an example of it working in the wild!

🖊️ Usage

NumberToWords.to_words(number) -> String

print(NumberToWords.to_words(1111000000))
> "one billion, one hundred and eleven million"

print(NumberToWords.to_words(12.5))
> "twelve point five"

print(NumberToWords.to_words(-12.59))
> "minus twelve point five nine"

print(NumberToWords.to_words(89_000))
> "eighty nine thousand"

print(NumberToWords.to_words(0x8f51))
> "thirty six thousand, six hundred and eighty nine"

print(NumberToWords.to_words(0b101010))
> "forty two"

print(NumberToWords.to_words(58.1e-2))
> "point five eight one"

NumberToWords.to_ordinal(number: int) -> String

print(NumberToWords.to_ordinal(1))
> "first"

print(NumberToWords.to_ordinal(22))
> "twenty second"

print(NumberToWords.to_ordinal(1003))
> "one thousand and third"

NumberToWords.to_ordinal_number(number: int) -> String

print(NumberToWords.to_ordinal_number(1))
> "1st"

print(NumberToWords.to_ordinal_number(22))
> "22nd"

print(NumberToWords.to_ordinal_number(1003))
> "1003rd"

NumberToWords.to_year(number: int) -> String

print(NumberToWords.to_year(1990))
> "nineteen ninety"

print(NumberToWords.to_year(2017))
> "twenty seventeen"

print(NumberToWords.to_year(1066))
> "ten sixty six"

print(NumberToWords.to_year(1865))
> "eighteen sixty five"

print(NumberToWords.to_year(2001))
> "two thousand and one"

print(NumberToWords.to_year(1901))
> "nineteen oh one"

🙏 Credits

🍪 This project was created with cookiecutter and the verillious/cookiecutter-godot project template.

🎨 Icon created by Freepik - Flaticon

Version

0.1.2-alpha

Engine

3.4

Category

Misc

Download

Version0.1.2-alpha
Download

Support

If you need help or have questions about this plugin, please contact the author.

Contact Author