X.Extensions.Text 3.3.1

Prefix Reserved
dotnet add package X.Extensions.Text --version 3.3.1                
NuGet\Install-Package X.Extensions.Text -Version 3.3.1                
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="X.Extensions.Text" Version="3.3.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add X.Extensions.Text --version 3.3.1                
#r "nuget: X.Extensions.Text, 3.3.1"                
#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.
// Install X.Extensions.Text as a Cake Addin
#addin nuget:?package=X.Extensions.Text&version=3.3.1

// Install X.Extensions.Text as a Cake Tool
#tool nuget:?package=X.Extensions.Text&version=3.3.1                

X.Extensions.Text

Overview

The X.Extensions.Text library provides a set of utility classes designed to simplify common text processing tasks in .NET applications. It is ideal for developers looking to handle string manipulations, such as substring extraction, character cleaning, plain text conversion from HTML, and keyword extraction efficiently.

Installation

To use the X.Extensions.Text library in your project, include it as a dependency in your .NET project. You can install it from NuGet.

Usage

TextHelper

Static methods contained within this class provide functionality for text manipulation without the need to instantiate any object.

Features:

  • Substring Extraction: Get a substring from a text string optionally ending with a specified string if the text exceeds a certain length.
  • Character Cleaning: Remove or replace system characters and excessive spaces from a text string.
  • HTML to Plain Text Conversion: Convert HTML content to plain text, with options to preserve HTML line breaks.
  • Keyword Extraction: Extract the most frequent keywords from a string, useful for generating metadata or summaries.

StringExtensions

Extension methods for the System.String class leveraging the TextHelper utilities to extend string functionalities directly on string objects.

Methods:

  • Substring(this string text, int length, string endPart): Extension method to extract a substring.
  • CleanCharacters(this string text): Clean system-defined characters from the string.
  • Replace(this string text, IEnumerable<string> forReplace, string whichReplace): Replace specified substrings.
  • ToPlainText(this string text, bool saveHtmlLineBreaks): Convert HTML formatted string to plain text.
  • GetKeywords(this string text, int count): Extract keywords from text.

Examples

using X.Extensions.Text;

string exampleHtml = "<p>Hello World!</p>";
string plainText = exampleHtml.ToPlainText();
Console.WriteLine(plainText); // Outputs: Hello World!

string longText = "This is a very long piece of text that needs to be shortened.";
string shortText = longText.Substring(20, "...");
Console.WriteLine(shortText); // Outputs: This is a very long...

string keywords = longText.GetKeywords(5);
Console.WriteLine(keywords); // Example output based on text content.

Contributing

Contributions to the X.Extensions.Text library are welcome. Please ensure to follow the contributing guidelines specified in the repository for submitting issues, feature requests, or pull requests.

License

The X.Extensions.Text library is released under MIT license.

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 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. 
.NET Core netcoreapp1.0 was computed.  netcoreapp1.1 was computed.  netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard1.3 is compatible.  netstandard1.4 was computed.  netstandard1.5 was computed.  netstandard1.6 was computed.  netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net46 was computed.  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 tizen30 was computed.  tizen40 was computed.  tizen60 was computed. 
Universal Windows Platform uap was computed.  uap10.0 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 1.3

  • .NETStandard 2.0

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.
  • net6.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.

Version Downloads Last updated
3.3.1 359 8/22/2024
3.3.0 246 7/22/2024