ITN.Utils.Strings
1.1.0
.NET 8.0
This package targets .NET 8.0. The package is compatible with this framework or higher.
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
dotnet add package ITN.Utils.Strings --version 1.1.0
NuGet\Install-Package ITN.Utils.Strings -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="ITN.Utils.Strings" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ITN.Utils.Strings" Version="1.1.0" />
<PackageReference Include="ITN.Utils.Strings" />
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 ITN.Utils.Strings --version 1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ITN.Utils.Strings, 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 ITN.Utils.Strings@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=ITN.Utils.Strings&version=1.1.0
#tool nuget:?package=ITN.Utils.Strings&version=1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
StringExtensions for C#
A lightweight and handy collection of C# extension methods for working with strings.
This library provides commonly used string utilities such as slug generation, title casing, email validation, diacritic removal, Base64 encoding/decoding, and more.
✨ Features
- ✅ Convert strings to URL-friendly slugs
- ✅ Capitalize the first letter of each word (title case)
- ✅ Remove diacritics (accents) from characters
- ✅ Validate email addresses
- ✅ Generate random file names
- ✅ Truncate strings with ellipsis (optionally keep full words)
- ✅ Count words in a string
- ✅ Encode / Decode Base64
📦 Installation
dotnet add package ITN.Utils.Strings
or
Install-Package ITN.Utils.Strings
🚀 Usage
using ITN.Utils.Strings;
class Example
{
void Run()
{
string title = "Hello world from CSharp";
string slug = title.ToSlug();
// hello-world-from-csharp
string titleCase = title.ToTitleCase();
// Hello World From Csharp
string noDiacritics = "Crème brûlée".RemoveDiacritics();
// Creme brulee
bool isEmailValid = "example@email.com".IsEmailValid();
// true
string fileName = StringExtensions.GenerateFileName("jpg");
// e.g., 20250807105626143.jpg
string shortText = "This is a very long sentence".Truncate(10);
// "This is a..."
int wordCount = " Count these words ".CountWords();
// 3
string encoded = "Hello".ToBase64();
// SGVsbG8=
string decoded = "SGVsbG8=".FromBase64();
// Hello
}
}
📚 Method Reference
| Method | Description |
|---|---|
ToSlug(this string input) |
Converts string to URL-friendly slug (lowercase, hyphen-separated) |
ToTitleCase(this string input) |
Capitalizes the first letter of each word |
RemoveDiacritics(this string input) |
Removes accents/diacritics from characters |
GenerateFileName(string extension) |
Generates a random file name with specified extension |
IsEmailValid(this string email) |
Validates if the input is a valid email address |
Truncate(this string input, int maxLength, bool keepFullWords) |
Truncates string and adds ellipsis if it exceeds length |
CountWords(this string input) |
Counts the number of words in the string |
ToBase64(this string input, Encoding encoding = null) |
Encodes a string to Base64 using the specified encoding (UTF8 by default) |
FromBase64(this string input, Encoding encoding = null) |
Decodes a Base64 string using the specified encoding (UTF8 by default) |
📄 License
MIT License
| 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 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 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- No dependencies.
-
net8.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.