TJC.StringExtensions 0.6.0

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

// Install TJC.StringExtensions as a Cake Tool
#tool nuget:?package=TJC.StringExtensions&version=0.6.0                

GitHub Tag GitHub Release NuGet Version

NuGet Downloads Size License

codecov

Table of Contents


Pluralize

string string.Pluralize(int number, string? pluralized = null)

  • Takes a string and pluralizes it based on the number provided.
var item = "apple";
var plural = item.Pluralize(2);
Console.WriteLine(plural); // apples

string IEnumerable<object>.Pluralize(string nonPluralized, string? pluralized = null)

  • Takes a collection of objects and pluralizes a string based on the number of objects in the collection.
// Multiple items in a collection results in a pluralized string
var itemsMultiple = new List<string> { "item1", "item2", "item3" };
var plural = itemsMultiple.Pluralize("item");
Console.WriteLine(plural); // items

// A single item in a collection results in a singular string
var itemsSingle = new List<string> { "item1" };
var singluar = itemsSingle.Pluralize("item");
Console.WriteLine(singluar); // item

Separator

string IEnumerable<string>.JoinComma()

  • Joins a collection of strings with a comma and space.
var items = new List<string> { "one", "two", "three" };
var result = items.JoinComma(); // one, two, three

Parsing

string string.KeepAlpha()

  • Keep letters only.
// Arrange
var input = "a1!b2@c3#.d4$ e5%";
var result = input.KeepAlpha(); // abcde

string string.KeepNumeric()

  • Keep numbers only.
// Arrange
var input = "a1!b2@c3#.d4$ e5%";
var result = input.KeepNumeric(); // 12345

string string.KeepNumericAndPeriod()

  • Keep numbers and periods only.
// Arrange
var input = "a1!b2@c3#.d4$ e5%";
var result = input.KeepNumericAndPeriod(); // 123.45

string string.KeepAlphaNumeric()

  • Keep letters and numbers only.
// Arrange
var input = "a1!b2@c3#.d4$ e5%";
var result = input.KeepAlphaNumeric(); // a1b2c3d4e5

string string.KeepAlphaNumericAndSpace()

  • Keep letters, numbers, and spaces only.
// Arrange
var input = "a1!b2@c3#.d4$ e5%";
var result = input.KeepAlphaNumericAndSpace(); // a1b2c3d4 e5

string string.RemoveSymbols(char[]? exceptions = null)

  • Remove symbols from a string, except any exceptions provided.
// Arrange
var input = "a1!b2@c3#.d4$ e5%";
var result = input.RemoveSymbols(['!', '.']); // a1!b2c3.d4 e5

Lines

IEnumerable<string> string.SplitNewLine()

  • Splits a string into lines on a new line character.

IEnumerable<string> string.SplitLines(int width = 60, char separator = ' ')

  • Splits a string into lines of a max width with a separator character.

string string.RemoveMultipleBlankLines()

  • Remove multiple blank lines from a string.

Padding

string string.PadBoth(int length)

  • Pads both side of a string so that it's centered between the padding
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 (5)

Showing the top 5 NuGet packages that depend on TJC.StringExtensions:

Package Downloads
TJC.AssemblyExtensions

Extensions for the Assembly

TJC.TimeExtensions

DateTime & TimeSpan Extensions

TJC.Collection.Core

Collection of NuGet Packages

TJC.Logging

Logging

TJC.ConsoleApplication

Console Application Utilities

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.6.3 310 11/15/2024
0.6.2 84 11/10/2024
0.6.1 760 11/5/2024
0.6.0 79 11/5/2024
0.5.2 644 10/26/2024
0.5.1 988 10/26/2024
0.5.0 78 10/25/2024
0.4.3 71 10/25/2024
0.4.2 128 10/25/2024
0.3.0 234 10/20/2024
0.2.2 410 10/20/2024
0.2.1 380 10/16/2024
0.2.0 2,726 10/10/2024
0.1.10 1,044 9/29/2024
0.1.9 1,165 9/5/2024
0.1.8 276 9/5/2024
0.1.7 467 9/5/2024
0.1.6 260 9/4/2024
0.1.5 118 9/3/2024
0.1.4 366 8/22/2024
0.1.3 137 8/22/2024
0.1.2 187 7/26/2024
0.1.1 112 7/24/2024
0.1.0 458 7/22/2024

# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.6.0] - 2024-11-05

## [0.5.2] - 2024-10-26

### Added

- Release notes to the NuGet Package

## [0.5.1] - 2024-10-26

### Fixed

- Bug with code case converter regex

## [0.5.0] - 2024-10-25

### Added

- Code case converters (Pascal, Camel, Snake, Kebab, Train)

## [0.4.0] - 2024-10-25

### Added

- Split camel case extension

## [0.3.0] - 2024-10-20

### Added

- Codecov reporting

## [0.2.0] - 2024-10-10

### Added

- Changelog Automation

## [0.1.10] - 2024-09-28

### Added

- Created many extensions

[Unreleased]: https://github.com/TJC-Tools/TJC.StringExtensions/compare/v0.6.0...HEAD

[0.6.0]: https://github.com/TJC-Tools/TJC.StringExtensions/compare/v0.5.2...v0.6.0

[0.5.2]: https://github.com/TJC-Tools/TJC.StringExtensions/compare/v0.5.1...v0.5.2

[0.5.1]: https://github.com/TJC-Tools/TJC.StringExtensions/compare/v0.5.0...v0.5.1

[0.5.0]: https://github.com/TJC-Tools/TJC.StringExtensions/compare/v0.4.0...v0.5.0

[0.4.0]: https://github.com/TJC-Tools/TJC.StringExtensions/compare/v0.3.0...v0.4.0

[0.3.0]: https://github.com/TJC-Tools/TJC.StringExtensions/compare/v0.2.0...v0.3.0

[0.2.0]: https://github.com/TJC-Tools/TJC.StringExtensions/compare/v0.1.10...v0.2.0

[0.1.10]: https://github.com/TJC-Tools/TJC.StringExtensions/releases/tag/v0.1.10