ByteDev.Strings 2.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package ByteDev.Strings --version 2.0.0                
NuGet\Install-Package ByteDev.Strings -Version 2.0.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="ByteDev.Strings" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ByteDev.Strings --version 2.0.0                
#r "nuget: ByteDev.Strings, 2.0.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.
// Install ByteDev.Strings as a Cake Addin
#addin nuget:?package=ByteDev.Strings&version=2.0.0

// Install ByteDev.Strings as a Cake Tool
#tool nuget:?package=ByteDev.Strings&version=2.0.0                

ByteDev.Strings

Set of string extension methods.

Installation

ByteDev.Strings has been written as a .NET Standard 2.0 library, so you can consume it from a .NET Core or .NET Framework 4.6.1 (or greater) application.

ByteDev.Strings is hosted as a package on nuget.org. To install from the Package Manager Console in Visual Studio run:

Install-Package ByteDev.Strings

Further details can be found on the nuget page.

Release Notes

Releases follow semantic versioning.

Full details of the release notes can be viewed on GitHub.

Code

The repo can be cloned from git bash:

git clone https://github.com/ByteDev/ByteDev.Strings

Usage

String Extensions

To use any extension methods simply reference the ByteDev.Strings namespace.

Assembly contains string extension methods:

  • AddPrefix
  • AddSuffix
  • ContainsIgnoreCase
  • CountOccurrences
  • FormatWith
  • IsDigit
  • IsDigits
  • IsEmpty
  • IsEmailAddress
  • IsGuid
  • IsHex
  • IsHttpUrl
  • IsIpAddress
  • IsLetters
  • IsNullOrEmpty
  • IsNullOrWhitespace
  • IsNotNullOrEmpty
  • IsNumeric
  • IsXml
  • Left
  • LeftWithEllipsis
  • LeftWithInnerEllipsis
  • Mask
  • Pluralize
  • Remove
  • RemoveStartsWith
  • RemoveEndsWith
  • RemoveBracketedText
  • RemoveWhiteSpace
  • Repeat
  • ReplaceFirst
  • ReplaceLast
  • ReplaceToken
  • Reverse
  • Right
  • SafeLength
  • SafeSubstring
  • ToTitleCase
  • ToLines
  • ToByteArray
  • ToIntOrDefault
  • ToLongOrDefault
  • ToDateTimeOrDefault
  • ToEnum

ToStringHelper

The assembly also contains the type ToStringHelper to help return string representations of an object when overriding it's ToString method.

public class MyClass
{
    public string Name => "John";

    public string Age => null;

    public IEnumerable<string> Address => new List<string>
    {
        "123 Highstreet",
        "London",
        "UK"
    };

    public override string ToString()
    {
        var helper = new ToStringHelper("<null>");

        return helper.ToString(nameof(Name), Name) + ", " +
                helper.ToString(nameof(Age), Age) + ", " +
                helper.ToString(nameof(Address), Address);
    }
}

// ...
string s = new MyClass().ToString();

// s == "Name: John, Age: <null>, Address: { 123 Highstreet, London, UK }"
Product 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 was computed.  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 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.

NuGet packages (6)

Showing the top 5 NuGet packages that depend on ByteDev.Strings:

Package Downloads
ByteDev.Io

Set of IO related .NET utility classes.

ByteDev.ResourceIdentifier

.NET Standard library of resource identifier (URI) related functionality.

ByteDev.Validation.Fluent

Extensions and functionality to use with the Fluent Validation library.

ByteDev.Nuget.Nuspec

.NET Standard library for reading nuget nuspec manifest files.

ByteDev.Subtitles.SubRip

.NET Standard library to help when using SubRip subtitles.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
11.2.0 331 3/20/2024
11.1.0 2,339 12/13/2022
11.0.0 598 6/20/2022
10.0.0 752 6/2/2022
9.5.0 2,743 11/30/2021
9.4.0 1,031 8/16/2021
9.3.0 4,996 7/14/2021
9.2.0 567 5/27/2021
9.1.0 2,951 3/29/2021
9.0.0 374 3/15/2021
8.3.0 521 3/10/2021
8.2.0 363 1/28/2021
8.1.0 561 12/31/2020
8.0.0 739 11/10/2020
7.0.0 437 11/5/2020
6.0.0 648 9/30/2020
5.0.0 424 9/28/2020
4.1.0 787 7/17/2020
4.0.0 457 7/1/2020
3.0.0 510 6/16/2020
2.1.0 555 5/29/2020
2.0.1 506 5/29/2020
2.0.0 467 5/28/2020
1.0.0 533 4/30/2020