TextUtilities 1.0.2
dotnet add package TextUtilities --version 1.0.2
NuGet\Install-Package TextUtilities -Version 1.0.2
<PackageReference Include="TextUtilities" Version="1.0.2" />
<PackageVersion Include="TextUtilities" Version="1.0.2" />
<PackageReference Include="TextUtilities" />
paket add TextUtilities --version 1.0.2
#r "nuget: TextUtilities, 1.0.2"
#addin nuget:?package=TextUtilities&version=1.0.2
#tool nuget:?package=TextUtilities&version=1.0.2
📝TextUtilities
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:
- Normalizing Persian Text
using TextUtilities;
string result = new TextUtility("hello world")
.NormalizePersian()
.ToUpperCase()
.Build();
Console.WriteLine(result);
- Creating a URL-Friendly Slug
using TextUtilities;
string result = new TextUtility("Hello World! @#$")
.ToSlug()
.Build();
Console.WriteLine(result);
// Output: hello-world
- 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**
- 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
- 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>
- 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 | Versions 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. |
-
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.