TextUtilities 1.0.2

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

📝TextUtilities

License: MIT NuGet NuGet Downloads .NET Version

TextUtilities is a fluent, lightweight, and powerful .NET library designed for advanced text manipulation. Whether you're normalizing Persian text, creating URL-friendly slugs, formatting text with HTML or Markdown, or performing complex string operations, TextUtilities offers an intuitive Fluent API to make your code clean and efficient.


✨ Features

  • Fluent API: Chain methods for readable and maintainable code.
  • Multilingual Support: Normalize Persian/Arabic characters (e.g., converting ي to ی or ك to ک).
  • Text Formatting: Add HTML/Markdown bold tags, prefixes, or perform regex-based replacements.
  • Advanced Text Operations: Create URL slugs, reverse text or words, count words, and more.
  • Lightweight: Minimal dependencies, optimized for performance.
  • Reliable: Fully tested with xUnit to ensure quality and stability.
  • Cross-Platform: Built for .NET 9.0, compatible with modern .NET applications.

📦 Installation

To use TextUtilities in your project, install it via NuGet:

dotnet add package TextUtilities --version 1.0.1

Or, if you prefer using the Package Manager Console:

Install-Package TextUtilities -Version 1.0.1

🚀Quick Start

Get started with TextUtilities in just a few lines of code:

using TextUtilities;

string result = new TextUtility("Hello World!")
    .RemoveSpaces()
    .ToBold()
    .AddPrefix("Output: ")
    .Build();

Console.WriteLine(result);
// Output: Output: <b>HelloWorld!</b>

🛠️Usage Examples

Below are some practical examples to demonstrate the power of TextUtilities:

  1. Normalizing Persian Text
using TextUtilities;

string result = new TextUtility("hello world")
    .NormalizePersian()
    .ToUpperCase()
    .Build();

Console.WriteLine(result);
  1. Creating a URL-Friendly Slug
using TextUtilities;

string result = new TextUtility("Hello World! @#$")
    .ToSlug()
    .Build();

Console.WriteLine(result);
// Output: hello-world
  1. Chaining Multiple Operations
using TextUtilities;

string result = new TextUtility("This is a TEST string!")
    .ToLowerCase()
    .RemoveSpaces()
    .ToMarkdownBold()
    .ToSlug()
    .AddPrefix("Slug: ")
    .Build();

Console.WriteLine(result);
// Output: Slug: **thisisateststring**
  1. Reversing Words and Counting
using TextUtilities;

string text = "Hello Beautiful World";
var utility = new TextUtility(text);

string reversed = utility.ReverseWords().Build();
int wordCount = utility.WordCount();

Console.WriteLine($"Reversed: {reversed}");
Console.WriteLine($"Word Count: {wordCount}");
// Output:
// Reversed: World Beautiful Hello
// Word Count: 3
  1. Resetting Text
using TextUtilities;

var utility = new TextUtility("Hello World");
string modified = utility.ToSlug().Build(); // hello-world
string reset = utility.Reset().ToBold().Build(); // <b>Hello World</b>

Console.WriteLine($"Modified: {modified}");
Console.WriteLine($"Reset: {reset}");
// Output:
// Modified: hello-world
// Reset: <b>Hello World</b>
  1. Regex Replacement
using TextUtilities;

string result = new TextUtility("Hello123World456")
    .ReplaceRegex("[0-9]+", "X")
    .Build();

Console.WriteLine(result);
// Output: HelloXWorldX

🧪Testing

TextUtilities is thoroughly tested using xUnit to ensure reliability. To run the tests locally:

  • Clone the repository:
git clone https://github.com/hheydarian/TextUtilities.git
  • Navigate to the project directory:
cd TextUtilities
  • Run the tests:
dotnet test

All 9+ unit tests should pass, covering key functionality.

🤝Contributing

We welcome contributions to make TextUtilities even better! To contribute:

  • Fork the repository.

  • Create a new branch:

git checkout -b feature/YourFeature
  • Make your changes and commit:
git commit -m 'Add some feature'
  • Push to your branch:
git push origin feature/YourFeature
  • Open a Pull Request on GitHub.

Please ensure your code follows the existing style, includes unit tests, and passes all checks.

📄License

This project is licensed under the MIT License (LICENSE). See the LICENSE file for details.

📭Contact & Support

  • Author: Hamed Heydarian

  • GitHub: hheydarian

  • NuGet: TextUtilities

  • Issues: Report bugs or suggest features on GitHub Issues

For questions or feedback, feel free to open an issue or reach out!


⭐Enjoying TextUtilities? Give it a star on GitHub!⭐

Thank you for using TextUtilities!🚀

Product Compatible and additional computed target framework versions.
.NET 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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.

Version Downloads Last updated
1.0.2 127 4/24/2025
1.0.1 125 4/23/2025
1.0.0 155 4/7/2025