AmountToWordsLibrary_dotNET 1.0.0.3

dotnet add package AmountToWordsLibrary_dotNET --version 1.0.0.3
                    
NuGet\Install-Package AmountToWordsLibrary_dotNET -Version 1.0.0.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AmountToWordsLibrary_dotNET" Version="1.0.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AmountToWordsLibrary_dotNET" Version="1.0.0.3" />
                    
Directory.Packages.props
<PackageReference Include="AmountToWordsLibrary_dotNET" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AmountToWordsLibrary_dotNET --version 1.0.0.3
                    
#r "nuget: AmountToWordsLibrary_dotNET, 1.0.0.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AmountToWordsLibrary_dotNET@1.0.0.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AmountToWordsLibrary_dotNET&version=1.0.0.3
                    
Install as a Cake Addin
#tool nuget:?package=AmountToWordsLibrary_dotNET&version=1.0.0.3
                    
Install as a Cake Tool

AmountToWordConverter

A static utility class to convert numbers to words in multiple languages and currencies.

A self-contained C#/.NET 6 or .NET Framework 4.7.2 class library designed for easy integration into any .NET application, including those using VB.NET. It converts an amount (represented by two decimal numbers) into its word representation, handling multiple languages and currency formats.

Note: The code is designed to be easily adaptable to almost any .NET Framework or .NET version.


Key Features

  • Multi-language Support: Automatically converts numbers to words in both English (en-US) and Spanish (es-MX).
  • Currency Handling: Accurately formats currency for USD (dollars and cents) and MXN (pesos and centavos).
  • Extensible: Easily extend the class to support additional languages or number scales.
  • Robust Logic: Handles complex number conversions, including large numbers (millions, billions) and specific Spanish grammar rules (e.g., "veintiuno," "ciento" vs. "cien").

How to Use

  1. Installation To use this converter in your .NET project, you should first compile it into a .dll file.

    • Create a new Class Library project in Visual Studio.

    • Add the NumberToWordConverter.cs file to your new project.

    • Build the project.

    • The output NumberToWordConverter.dll file will be in the bin/Debug (or bin/Release) folder.

    • In your main application (e.g., a VB.NET or C# project), add a reference to this .dll file.

  2. Basic Usage The ToWords method serves as the primary entry point for the conversion. It requires a decimal number and a CultureInfo object to determine the language.

     // Example in C#
     using System;
     using MyProject.NumberToWords; // Assuming this is your project's namespace
     //
     decimal amount = 1234567890.50m;
     // Convert the number to words in Spanish
     string spanishWords = NumberToWordConverter.ToWords(amount,LanguageToUse.Spanish, CurrencyToUse.Dollar);
     Console.WriteLine(spanishWords);
    // Output: "Mil doscientos treinta y cuatro millones quinientos sesenta y siete mil ochocientos noventa dólares con cincuenta centavos"
    
    
    
  3. Automated Testing This project also includes a self-contained automated test suite in the NumberTowordsAutomatedTester() method. This is useful for verifying that the conversion logic works correctly for various numbers and languages.

    To run the tests, call this static method from your application's startup.

     // Example in C#
     public static void Main()
     {
         Console.WriteLine(NumberToWordConverter.NumberTowordsAutomatedTester());
     }
    

    It will output the results to the console.


Contributing

We welcome improvements and contributions! If you find a bug or have a suggestion for an improvement, feel free to open an issue or submit a pull request.


Support

If you find this project helpful and would like to support its continued development, you can donate via PayPal. PayPal: nandostyle@gmail.com

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0.3 283 9/19/2025