DoenaSoft.NumberSystemConverter 1.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package DoenaSoft.NumberSystemConverter --version 1.1.0
                    
NuGet\Install-Package DoenaSoft.NumberSystemConverter -Version 1.1.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="DoenaSoft.NumberSystemConverter" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DoenaSoft.NumberSystemConverter" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="DoenaSoft.NumberSystemConverter" />
                    
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 DoenaSoft.NumberSystemConverter --version 1.1.0
                    
#r "nuget: DoenaSoft.NumberSystemConverter, 1.1.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.
#:package DoenaSoft.NumberSystemConverter@1.1.0
                    
#: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=DoenaSoft.NumberSystemConverter&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=DoenaSoft.NumberSystemConverter&version=1.1.0
                    
Install as a Cake Tool

NumberSystemConverter

Allows you to convert numbers from and to string representatios of the most common number systems:

  • Binary (base 2) (2026 = 11111101010)
  • Octal (base 8) (2026 = 3752)
  • Decimal (base 10) (2026 = 2026)
  • Duodecimal (base 12) (2026 = 120↊)
  • Hexadecimal (base 16) (2026 = 7EA)

Language support for

  • Chinese
    • simplified (common) (2026 = 二千零二十六)
    • simplified (financial) (2026 = 贰仟零贰拾陆)
    • traditional (common) (2026 = 二千零二十六)
    • traditional (financial) (2026 = 貳仟零貳拾陸)
  • Japanese
    • common (2026 = 二千二十六)
    • financial (2026 = 弐千弐拾六)
  • Korean
    • Hangul (2026 = 이천이십육, 0 = )
    • Hanja (2026 = 二千二十六, 0 = )
    • financial (2026 = 貳仟貳拾陸, 0 = )
  • Eastern Arabic (2026 = ٢٠٢٦)
  • Persian (2026 = ۲۰۲۶)
  • Braille (2026 = ⠃⠚⠃⠋)
  • Roman (2026 = MMXXVI)

Installation

Install via NuGet:

dotnet add package DoenaSoft.NumberSystemConverter

Usage Examples

Basic Conversion

All converters implement the INumberSystemConverter interface with two methods:

  • string FromULong(ulong input) - converts a number to its string representation
  • ulong ToULong(string input) - converts a string representation back to a number
using DoenaSoft.NumberSystemConverter.BaseX;
using DoenaSoft.NumberSystemConverter.Roman;
using DoenaSoft.NumberSystemConverter.Chinese;
using DoenaSoft.NumberSystemConverter.Japanese;
using DoenaSoft.NumberSystemConverter.Korean;

// Hexadecimal
var hexConverter = new HexadecimalConverter();
string hex = hexConverter.FromULong(2026);       // "7EA"
ulong number = hexConverter.ToULong("7EA");      // 2026

// Binary
var binaryConverter = new BinaryConverter();
string binary = binaryConverter.FromULong(2026); // "11111101010"
ulong num = binaryConverter.ToULong("11111101010"); // 2026

// Roman Numerals
var romanConverter = new NumeralConverter();
string roman = romanConverter.FromULong(2026);   // "MMXXVI"
ulong year = romanConverter.ToULong("MMXXVI");   // 2026

East Asian Number Systems

Chinese
using DoenaSoft.NumberSystemConverter.Chinese;

// Simplified Chinese (Common)
var commonSimplified = new CommonSimplifiedNumeralConverter();
string chinese = commonSimplified.FromULong(2026);
// Result: "二千零二十六"

// Simplified Chinese (Financial)
var financialSimplified = new FinancialSimplifiedNumeralConverter();
string chineseFin = financialSimplified.FromULong(2026);
// Result: "贰仟零贰拾陆"

// Traditional Chinese (Common)
var commonTraditional = new CommonTraditionalNumeralConverter();
string traditionalChi = commonTraditional.FromULong(2026);
// Result: "二千零二十六"

// Traditional Chinese (Financial)
var financialTraditional = new FinancialTraditionalNumeralConverter();
string traditionalFin = financialTraditional.FromULong(2026);
// Result: "貳仟零貳拾陸"
Japanese
using DoenaSoft.NumberSystemConverter.Japanese;

// Common Japanese
var commonJapanese = new CommonNumeralConverter();
string japanese = commonJapanese.FromULong(2026);
// Result: "二千二十六"

// Financial Japanese
var financialJapanese = new FinancialNumeralConverter();
string japaneseFin = financialJapanese.FromULong(2026);
// Result: "弐千弐拾六"
Korean
using DoenaSoft.NumberSystemConverter.Korean;

// Hangul (Native Korean script)
var hangul = new HangulNumeralConverter();
string korean = hangul.FromULong(2026);
// Result: "이천이십육"

// Hanja (Chinese characters)
var hanja = new HanjaKoreanNumeralConverter();
string koreanHanja = hanja.FromULong(2026);
// Result: "二千二十六"

// Financial (Financial Hanja for banking/legal)
var financial = new FinancialKoreanNumeralConverter();
string koreanFinancial = financial.FromULong(2026);
// Result: "貳仟貳拾陸"

Other Number Systems

using DoenaSoft.NumberSystemConverter.BaseX;

// Eastern Arabic Numerals
var easternArabic = new EasternArabicDecimalConverter();
string arabic = easternArabic.FromULong(2026);   // "٢٠٢٦"

// Persian Numerals
var persian = new PersianDecimalConverter();
string persianNum = persian.FromULong(2026);     // "۲۰۲۶"

// Braille Numerals
var braille = new BrailleDecimalConverter();
string brailleNum = braille.FromULong(2026);     // "⠃⠚⠃⠋"

// Octal
var octal = new OctalConverter();
string oct = octal.FromULong(2026);              // "3752"

// Duodecimal (base 12)
var duodecimal = new DuodecimalConverter();
string duo = duodecimal.FromULong(2026);         // "120↊"

Converting Between Number Systems

Use the Convert extension method to convert directly between any two number systems:

using DoenaSoft.NumberSystemConverter;
using DoenaSoft.NumberSystemConverter.BaseX;
using DoenaSoft.NumberSystemConverter.Chinese;
using DoenaSoft.NumberSystemConverter.Roman;

var hex = new HexadecimalConverter();
var chinese = new CommonSimplifiedNumeralConverter();
var roman = new NumeralConverter();

// Convert hexadecimal to Chinese
string chineseNumber = hex.Convert("7EA", chinese);
// Result: "二千零二十六"

// Convert Roman to hexadecimal
string hexNumber = roman.Convert("MMXXVI", hex);
// Result: "7EA"

// Convert Chinese to binary
var binary = new BinaryConverter();
string binaryNumber = chinese.Convert("二千零二十六", binary);
// Result: "11111101010"

Error Handling

using DoenaSoft.NumberSystemConverter;

try
{
	var converter = new HexadecimalConverter();
	ulong value = converter.ToULong("INVALID!");
}
catch (InvalidInputException ex)
{
	// Handle invalid input characters
	Console.WriteLine($"Invalid input: {ex.Message}");
}

try
{
	var romanConverter = new NumeralConverter();
	// Roman numerals don't support zero
	string roman = romanConverter.FromULong(0);
}
catch (InvalidInputException ex)
{
	Console.WriteLine($"Error: {ex.Message}");
}

Supported Frameworks

  • .NET Standard 2.0
  • .NET Framework 4.7.2
  • .NET 10.0

License

This project is licensed under the MIT License.

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.  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 is compatible.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 is compatible.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  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.
  • .NETFramework 4.7.2

    • No dependencies.
  • .NETStandard 2.0

    • No dependencies.
  • net10.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
2.0.0 90 3/29/2026
1.1.0 81 3/29/2026
1.0.7 699 12/1/2025
1.0.6 277 10/12/2024
1.0.5 179 10/12/2024
1.0.5-rc.3 114 10/12/2024
1.0.5-rc.2 116 10/12/2024
1.0.5-rc.1 117 10/12/2024
1.0.4 188 10/12/2024
1.0.4-beta.2 117 10/12/2024
1.0.4-beta.1 120 10/12/2024
1.0.3 181 10/12/2024
1.0.3-rc.3 115 10/12/2024
1.0.3-rc.2 111 10/12/2024
1.0.3-rc.1 125 10/12/2024
1.0.3-alpha.4 104 10/12/2024
1.0.3-alpha.3 125 10/11/2024
1.0.3-alpha.2 124 10/11/2024
1.0.3-alpha.1 122 10/11/2024
1.0.2 173 10/11/2024
Loading failed