Skip to content

kamilos-dev/TWord

Repository files navigation

TWord

CI CD codecov Version

Download

  • NuGet: dotnet add package TWord

Description

Library to transform number or amount of money to words.

Available languages

Language
USFlag English
GermanyFlag Germany
PolandFlag Polish

If language that interest you is not listed - create issue, I will do my best to add it.

Available currencies

Using ISO-4217

Currency
EUFlag EUR
PolandFlag PLN
USFlag USD

If currency that interest you is not listed - create issue, I will do my best to add it.

Flag icons comes from https://github.com/tkrotoff/famfamfam_flags

Usage

Number to words

To transform number to words use code like below.

public static class Program
{
	INtWord nt = new NtWordBuilder()
                .SetLanguage(Language.English)
                .Build(); 

	var words = nt.ToWords(56123);

	// Words is equal to 
	// fifty six thousand one hundred twenty three
}

NtWordBuilder Extension Methods

Method Description
SetLanguage(Language) sets the language. See: availabe languages

Amount of money to words usage

To transform amount of money to words use code like below.

public static class Program
{
	 IAtWord at = new AtWordBuilder()
                .SetLanguage(Language.English)
                .SetCurrency(CurrencySymbol.USD)
                .Build(); 

	var words = at.ToWords(56123.01m);

	// Words is equal to
	// fifty six thousand one hundred twenty three dollars one cent
}

AtWordBuilder Extension Methods

Method Description
SetLanguage(Language) sets the language. See: availabe languages
SetCurrency(CurrencySymbol) sets the currency. See: availabe currencies
IntegerPartOnly() omnits decimal part from given amount. Example: 100.04 returns one hundred dollars
DecimalPartAsFraction() displays decimal part as fraction. Example: 100.04 returns one hundred dollars 4/100 cents
HideSubunit() hides decimal part as fraction. usually use with DecimalPartAsFraction(). Example: 100.04 returns one hundred dollars 4/100
IntegerAndDecimalPartSeparator(string) sets integer and decimal part separator. If separator is and, value is 100.04 result will be one hundred dollars and four cents

About

Library to change number or cash amount to words

Resources

License

Stars

Watchers

Forks