Ada.Numbers 2.0.0

dotnet add package Ada.Numbers --version 2.0.0
NuGet\Install-Package Ada.Numbers -Version 2.0.0
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="Ada.Numbers" Version="2.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Ada.Numbers --version 2.0.0
#r "nuget: Ada.Numbers, 2.0.0"
#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.
// Install Ada.Numbers as a Cake Addin
#addin nuget:?package=Ada.Numbers&version=2.0.0

// Install Ada.Numbers as a Cake Tool
#tool nuget:?package=Ada.Numbers&version=2.0.0

Ada.Numbers

What's new?

  • Support for english numbers;
  • Customizable settings for converters: choose language and scale.

Features:

  • It converts a number to its equivalent in written words, i.e. 123 to "cento e vinte três" or 123 to "one hundred and twenty-three" depending on the chosen language;
  • It converts a word to its equivalent in number, i.e. "cento e vinte dois" to "122" or "one hundred and twenty-two" to "122".

Note: ada.numbers supports numbers with a maximum of 15 digits.

Specification

Available namespaces are:

  • Ada.Numbers.Settings which contains the settings for the converters;
  • Ada.Numbers.Converters which contains the extension methods for conversion;
  • Ada.Numbers.Constants which contains the constants used in conversions;
  • Ada.Numbers.Utilities which contains some useful methods such as the number of digits and the category of the number.

Ada.Numbers.Settings

Used to set the parameters of the converters. Available parameters are:

  • Language;
  • Scale.

To set the language, it is done as follows:

Settings.Language = Settings.Parameters.Languages.En //Now, converters will use English

To set the scale, it is done as follows:

Settings.Scale = Settings.Parameters.Scales.Short //Now, converters will use Short Scale

To learn more about scales, read this.

The Settings are global, meaning that once they are set, every operation is affected, so, in order to have a different behavior, the Settings must be explicitly set. Per default, Language is Portuguese and the Scale is Long.

Ada.Numbers.Converters

For string, the method is .ToNumber().

Examples:

var number = "vinte e dois";
number.ToNumber() // > "22"

Settings.Language = Settings.Parameters.Languages.En //Now, converters will use English
number = "twenty-two";
number.ToNumber(); // > "22"

Check the method documentation for more details.

For numerical types (long, int, byte, decimal, double and float), the method is .ToWords().

var number = 22;
number.ToNumber() // > "Vinte e Dois"

Settings.Language = Settings.Parameters.Languages.En //Now, converters will use English
var number = 22;
number.ToNumber() // > "Twenty-two"

Check the method documentation for more details.

Ada.Numbers.Constants

It includes the classes:

  • Messages: for useful messages, check the class documentation for more details.
  • Separators: for number separator in Portuguese, check the class documentation for more details.
  • SeparatorsEn: for number separator in English, check the class documentation for more details.

Ada.Numbers.Utilities

It includes extension methods for:

  • .NumberOfDigits() available for long, int and byte: it returns the number of digits a number has.
var number = 22;
number.NumberOfDigits() // > 2
  • .Category() available for long, int and byte: it returns the the category of the number.
var number = 22;
number.Category() // > NumberCategory.Ten

NumberCategory is an enum, check its documentation for more details.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

    • 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
2.0.0 253 2/21/2023
1.0.0 205 2/15/2023

- Support for english numbers;
- Customizable settings for converters: choose language and scale