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
<PackageReference Include="Easy.Tools.StringHelpers" Version="1.0.9" />
<PackageVersion Include="Easy.Tools.StringHelpers" Version="1.0.9" />
<PackageReference Include="Easy.Tools.StringHelpers" />
paket add Easy.Tools.StringHelpers --version 1.0.9
#r "nuget: Easy.Tools.StringHelpers, 1.0.9"
#:package Easy.Tools.StringHelpers@1.0.9
#addin nuget:?package=Easy.Tools.StringHelpers&version=1.0.9
#tool nuget:?package=Easy.Tools.StringHelpers&version=1.0.9
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, andValueTupleon 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 | Versions 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. |
-
.NETFramework 4.7
- System.Memory (>= 4.5.5)
- System.ValueTuple (>= 4.5.0)
-
.NETFramework 4.7.2
- System.Memory (>= 4.5.5)
- System.ValueTuple (>= 4.5.0)
-
.NETFramework 4.8
- System.Memory (>= 4.5.5)
- System.ValueTuple (>= 4.5.0)
-
.NETStandard 2.0
- System.Memory (>= 4.5.5)
-
.NETStandard 2.1
- No dependencies.
-
net10.0
- No dependencies.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.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.
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.