Alphadex 2.0.1
dotnet add package Alphadex --version 2.0.1
NuGet\Install-Package Alphadex -Version 2.0.1
<PackageReference Include="Alphadex" Version="2.0.1" />
<PackageVersion Include="Alphadex" Version="2.0.1" />
<PackageReference Include="Alphadex" />
paket add Alphadex --version 2.0.1
#r "nuget: Alphadex, 2.0.1"
#:package Alphadex@2.0.1
#addin nuget:?package=Alphadex&version=2.0.1
#tool nuget:?package=Alphadex&version=2.0.1
Alphadex
A .NET library for converting zero-based indices to alphabetic sequences, similar to Excel column naming (A, B, C, ... Z, AA, AB, etc.). Perfect for generating column names, sequence identifiers, or any scenario where you need human-readable alphabetic progression.
Features
- 🔤 Convert any zero-based index to an alphabetic sequence
- 🔄 Supports infinite sequences with recursive prefixing
- ⚙️ Customizable character sets (not limited to A-Z)
- 📦 Lightweight .NET Standard 2.0 library
- 🚀 High performance with simple API
Installation
Install the package via NuGet Package Manager:
dotnet add package Alphadex
Or via Package Manager Console in Visual Studio:
Install-Package Alphadex
Quick Start
using Alphadex;
var service = new AlphaNumericService();
Console.WriteLine(service.GetString(0)); // Output: "A"
Console.WriteLine(service.GetString(25)); // Output: "Z"
Console.WriteLine(service.GetString(26)); // Output: "AA"
Usage
Basic Usage
The default character set is the English alphabet (A-Z).
var alphaSvc = new AlphaNumericService();
// Single characters (0-25)
alphaSvc.GetString(0); // returns "A"
alphaSvc.GetString(1); // returns "B"
alphaSvc.GetString(2); // returns "C"
alphaSvc.GetString(25); // returns "Z"
// Double characters (26+)
alphaSvc.GetString(26); // returns "AA"
alphaSvc.GetString(27); // returns "AB"
alphaSvc.GetString(777); // returns "ACX"
Practical Examples
Excel-style column naming:
var columnService = new AlphaNumericService();
for (int i = 0; i < 30; i++)
{
Console.WriteLine($"Column {i}: {columnService.GetString(i)}");
}
// Output: Column 0: A, Column 1: B, ... Column 26: AA, Column 27: AB
Generating sequence identifiers:
var idGenerator = new AlphaNumericService();
var items = new List<string> { "Task 1", "Task 2", "Task 3" };
for (int i = 0; i < items.Count; i++)
{
Console.WriteLine($"{idGenerator.GetString(i)}: {items[i]}");
}
// Output: A: Task 1, B: Task 2, C: Task 3
Custom Character Sets
You can override the default character set by passing a custom string to the constructor.
// Using custom characters
var alphaSvc = new AlphaNumericService("SOMETEXT");
alphaSvc.GetString(0); // returns "S"
alphaSvc.GetString(1); // returns "O"
alphaSvc.GetString(2); // returns "M"
alphaSvc.GetString(7); // returns "T"
alphaSvc.GetString(8); // returns "SS" (wraps around with prefix)
How It Works
The algorithm works by:
- For indices within the character set length, it returns the character directly
- For indices beyond the set length, it calculates a prefix recursively and appends the remainder
This creates sequences like: A, B, C, ..., Z, AA, AB, AC, ..., AZ, BA, BB, BC, etc.
Requirements
- .NET Standard 2.0 or higher
- Compatible with .NET Framework 4.6.1+, .NET Core 2.0+, .NET 5+
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Product | Versions 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 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. |
.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 was computed. 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. |
-
.NETStandard 2.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.