This package provides a comprehensive set of number helper extensions for .NET, including calculations, conversions, and validations such as prime checks, clamping, rounding, Roman numeral conversions, and more.
$ dotnet add package Easy.Tools.NumberHelpersA comprehensive .NET library providing extension methods for advanced mathematical operations, number conversions, formatting, and banking-grade number-to-words transformation.
GCD, LCM, Factorial, IsPrime, RoundToNearest.PercentageOf, IncreaseByPercent, etc.1.5 MB) and numbers to metric (1.2k).IsApproximately).Install via NuGet Package Manager:
Install-Package Easy.Tools.NumberHelpers
Or via .NET CLI:
dotnet add package Easy.Tools.NumberHelpers
Supports USD, EUR, GBP, TRY, AZN, RUB and custom currencies.
using Easy.Tools.NumberHelpers.Extensions;
decimal amount = 1250.75m;
// Default English
// Output: "one thousand two hundred fifty dollar seventy-five cent"
Console.WriteLine(amount.ToWordsCurrency("en"));
// Turkish Banking Mode (Strict)
// Output: "bir bin iki yüz elli Türk Lirası yetmiş beş kuruş"
Console.WriteLine(amount.ToWordsCurrency("tr", isBankingMode: true));
// Normal Grammar
// Output: "bin iki yüz elli Türk Lirası yetmiş beş kuruş"
Console.WriteLine(amount.ToWordsCurrency("tr", isBankingMode: false));
long bytes = 10485760;
Console.WriteLine(bytes.ToFileSize()); // Output: "10 MB"
long views = 1500;
Console.WriteLine(views.ToMetric()); // Output: "1.5k"
int rank = 1;
Console.WriteLine(rank.ToOrdinal()); // Output: "1st"
int n = 7;
bool isPrime = n.IsPrime(); // true
long factorial = n.Factorial(); // 5040
int a = 12, b = 18;
int gcd = a.GCD(b); // 6
int lcm = a.LCM(b); // 36
double val = 0.1 + 0.2;
bool isEqual = val.IsApproximately(0.3); // true (solves floating point error)
int year = 2024;
string roman = year.ToRoman(); // "MMXXIV"
int number = "MMXXIV".FromRoman(); // 2024
double price = 100;
double newPrice = price.IncreaseByPercent(18); // 118
int input = 500;
int clamped = input.Clamp(0, 100); // 100 (Restricts value between min and max)
Contributions and suggestions are welcome. Please open an issue or submit a pull request.
This project is licensed under the MIT License.
© 2025 Elmin Alirzayev / Easy Code Tools