MutableStringLibrary 1.1.24

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

// Install MutableStringLibrary as a Cake Tool
#tool nuget:?package=MutableStringLibrary&version=1.1.24                

MutableStringLibrary

A simple wrapper around the .NET String class that allows for easy value comparison and modification, with or without case sensitivity.

NuGet: Install-Package MutableStringLibrary

Read the source code here.

For analyzing a string:

  • Has checks for a substring in a string. image
  • Is compares the string value with the value of another string.
  • IsLimitedToCharacters checks if the characters of a string are limited to a given set of characters.

For modifying a string:

  • CutAt removes a given section from the string and returns the removed part.
  • CutBeginningAt returns the characters until the given position and keeps the remainder.
  • CutEntAt returns the characters efter the given position and keeps the beginning.
  • LimitToCharacters removes any character that is not represented in a given set of characters.
  • MiddleTrim changes any whitespaces to a single space.
  • Reset sets the value to the default value, depending on the DefaultsToNull flag.

Flags:

  • AutoTrim
  • DefaultsToNull
  • IgnoreCase

For modifying a string list:

  • CutAt removes a given section from the string and returns the removed part.
  • CutBeginningAt returns the characters until the given position and keeps the remainder.
  • CutEntAt returns the characters efter the given position and keeps the beginning.

Examples: Functions for modifying a string

These functions modify the string object and returns the difference.

CutBeginningAt

The function CutBeginningAt removes the beginning of a string and returns the removed part as a mutable string with the same flags as the original.

Basic example:

var s1 = new MutableString("Paul Stanley");
var s2 = s1.CutBeginningAt(5);
Console.WriteLine(s2.Value); // Paul
Console.WriteLine(s1.Value); // Stanley

Advanced example:

class PositionFinder : IPositionFinder
{
    public int Find(MutableString value) =>
        5;
}

var s1 = new MutableString("Paul Stanley");
var s2 = s1.CutBeginningAt(new PositionFinder());
Console.WriteLine(s2.Value); // Paul
Console.WriteLine(s1.Value); // Stanley

CutEndAt

The function CutEndAt removes the end of a string and returns the removed part as a mutable string with the same flags as the original.

Basic example:

var s1 = new MutableString("Paul Stanley");
var s2 = s1.CutEndAt(5);
Console.WriteLine(s2.Value); // Stanley
Console.WriteLine(s1.Value); // Paul

Advanced example:

class PositionFinder : IPositionFinder
{
    public int Find(MutableString value) =>
        5;
}

var s1 = new MutableString("Paul Stanley");
var s2 = s1.CutEndAt(new PositionFinder());
Console.WriteLine(s2.Value); // Stanley
Console.WriteLine(s1.Value); // Paul

MiddleTrim

Replaces any whitespaces with a single space.

Example:

var x = new MutableString("abc   123");
Assert.True(s.MiddleTrim()); // Returns true if string is affected
Assert.True("abc 123");
Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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
1.1.24 218 12/15/2023
1.1.23 501 4/4/2022
1.0.9 445 2/13/2022
1.0.8 326 9/14/2021
1.0.6 359 5/6/2021
1.0.4 330 4/21/2021
1.0.3 354 4/17/2021
1.0.1 324 4/17/2021
1.0.0 345 4/10/2021

Moved to .NET 8.0 and updated dependencies.