Easy.Tools.StringHelpers 1.0.9

dotnet add package Easy.Tools.StringHelpers --version 1.0.9
                    
NuGet\Install-Package Easy.Tools.StringHelpers -Version 1.0.9
                    
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="Easy.Tools.StringHelpers" Version="1.0.9" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Easy.Tools.StringHelpers" Version="1.0.9" />
                    
Directory.Packages.props
<PackageReference Include="Easy.Tools.StringHelpers" />
                    
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 Easy.Tools.StringHelpers --version 1.0.9
                    
#r "nuget: Easy.Tools.StringHelpers, 1.0.9"
                    
#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 Easy.Tools.StringHelpers@1.0.9
                    
#: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=Easy.Tools.StringHelpers&version=1.0.9
                    
Install as a Cake Addin
#tool nuget:?package=Easy.Tools.StringHelpers&version=1.0.9
                    
Install as a Cake Tool

Build & Test Build & Release Build & Nuget Publish Release License NuGet

Easy.Tools.StringHelpers

Easy.Tools.StringHelpers is a high-performance, secure, and enterprise-ready .NET library providing a rich set of string extension methods. It is re-engineered with Zero-Allocation techniques for modern .NET, ReDoS protection for Regex operations, and strictly typed validation helpers.

Key Features

  • ** High Performance & Zero-Allocation:** Utilizes Span<T>, string.Create, and ValueTuple on modern frameworks (.NET 6+) to minimize memory pressure.
  • ** Security First:** - All internal Regex operations use Timeouts to prevent ReDoS (Regular Expression Denial of Service).
    • Random string/password generation uses CSPRNG (Cryptographically Secure Pseudo-Random Number Generator).
  • ** Enterprise Validation:** Built-in validators for Credit Cards (Luhn Algorithm), JSON, XML, URLs, Emails (RFC-compliant regex), and more.
  • ** Multi-Framework Support:** Runs everywhere. Supports .NET 10, .NET 9, .NET 8, .NET 6, .NET Standard 2.0/2.1, and .NET Framework 4.7.2+.

Installation

Install via NuGet Package Manager:

Install-Package Easy.Tools.StringHelpers

Or via .NET CLI:

dotnet add package Easy.Tools.StringHelpers

Usage Examples

1. Secure Validation

Validate inputs without throwing unnecessary exceptions.

using Easy.Tools.StringHelpers.Extensions;

// Email & Password Validation
if (userInput.IsValidEmail() && password.IsValidPassword(minLength: 10, requireSpecialChar: true))
{
    // Proceed safely...
}

// Credit Card Validation (Luhn Algorithm - Zero Allocation)
if (creditCardString.IsValidCreditCard()) 
{
    // Payment logic...
}

// JSON Structure Check
bool isJson = apiResponse.IsValidJson();

2. High-Performance Manipulation

Perform string operations with minimal memory footprint.

string title = "  High Performance Code  ";
// Slug generation (Supports Turkish characters: ı->i, ğ->g)
string slug = title.GenerateSlug(); // "high-performance-code"

string description = "This is a very long text that needs to be shortened.";
// Truncate using Span<T> optimizations
string preview = description.Truncate(20, addEllipsis: true); // "This is a very lo..."

3. PII Masking & Security

Securely handle sensitive data.

string email = "admin@example.com";
Console.WriteLine(email.MaskEmail()); // "ad***@example.com"

// Secure Random Password (CSPRNG)
string secret = GenerationExtensions.RandomPassword(16); 

Extension Categories

Category Description
ValidationExtensions Validate Email, Credit Card (Luhn), JSON, XML, URL, IP, Palindrome, etc.
SanitizeExtensions High-perf removal of HTML tags, special chars, digits (Loop-based).
TruncateExtensions Smart string truncation with ellipsis support (Zero-alloc).
ManipulationExtensions General manipulation: RemoveWhitespace, SplitLines, Repeat, NormalizeSpaces.
MaskingExtensions Mask sensitive data like Emails or IDs.
SearchExtensions ContainsAny, ContainsAll, CountOccurrences, IsNumeric.
TransformationExtensions GenerateSlug (Turkish support), ToInitials, Reverse.
FormatExtensions ToSnakeCase, ToKebabCase, RemoveDiacritics.
GenerationExtensions Secure Random String & Password generation.
ConversionExtensions Safe type conversions (ToIntOrNull, To<T>).
CasingExtensions ToTitleCase, ToInvariantLower, ToInvariantUpper.
PaddingExtensions PadLeftWith, PadRightWith, PadBothWith (Center alignment).
LengthExtensions Fluent length checks: LongerThan, ShorterThan, IsLengthBetween.
RegexExtensions Safe Regex matching and extraction with Timeouts.
DateParsingExtensions Detect if string contains a valid date.

Contributing

Contributions and suggestions are welcome. Please open an issue or submit a pull request.


License

This project is licensed under the MIT License.


2025 Elmin Alirzayev / Easy Code Tools

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  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 is compatible.  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 is compatible.  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 is compatible.  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 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 is compatible.  net471 was computed.  net472 is compatible.  net48 is compatible.  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.

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.9 95 1/30/2026
1.0.8 92 1/23/2026
1.0.7 88 1/23/2026
1.0.6 220 8/12/2025
1.0.5 271 8/8/2025
1.0.4 280 8/8/2025
1.0.1 172 7/31/2025

v1.0.9 - Enterprise Release
-  Zero-Allocation: Optimized using Span<T> and string.Create for modern .NET.
   -  Security: Added ReDoS protection (Regex timeouts) and CSPRNG for random generation.
-  Validation: Added validators for Credit Card (Luhn), URL, Email, JSON, and XML.
-  Masking: Secure masking for PII data (Emails, Credit Cards).
-  Compatibility: Full support for .NET 6+ to .NET Framework 4.7.