Minerals.StringCases 0.1.0

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

// Install Minerals.StringCases as a Cake Tool
#tool nuget:?package=Minerals.StringCases&version=0.1.0

Minerals.StringCases

Optimized NuGet package with minimum memory allocation designed to help you convert strings to names cases such as Pascal, Camel, Kebab, Snake, Macro, Train and Title.

Features

  • Wide choice of cases: PascalCase, camelCase, _underscoreCamelCase, kebab-case, snake_case, MACRO_CASE, Train-Case, Title Case.
  • Performance: The package is optimized for speed and memory allocation.
  • Universal: Convert from any freely formatted string.
  • Compatible with .NET Standard 2.0: Works on a wide range of platforms and development environments.

Installation

Add the Minerals.StringCases nuget package to your C# project using the following methods:

1. Project file definition

<PackageReference Include="Minerals.StringCases" Version="0.1.0" />

2. dotnet command

dotnet add package Minerals.StringCases

Usage

using Minerals.StringCases;

string sampleText = "  _ example Variable - - Name   321";

string pascalCase = sampleText.ToPascalCase();
// ExampleVariableName321

string camelCase = sampleText.ToCamelCase();
// exampleVariableName321

string underscoreCamelCase = sampleText.ToUnderscoreCamelCase();
// _exampleVariableName321

string kebabCase = sampleText.ToKebabCase();
// example-variable-name-321

string snakeCase = sampleText.ToSnakeCase();
// example_variable_name_321

string macroCase = sampleText.ToMacroCase();
// EXAMPLE_VARIABLE_NAME_321

string trainCase = sampleText.ToTrainCase();
// Example-Variable-Name-321

string titleCase = sampleText.ToTitleCase();
// Example Variable Name 321

Performance and comparison

Here is a comparison of the speed and amount of memory allocation with the most popular NuGet package similar to Minerals.StringCases version 0.1.0 - CaseExtesions version 1.1.0.

String used to perform the comparison:

string sampleText = "  _ example Variable - - Name   321";

Results

BenchmarkDotNet v0.13.12, Windows 10 (10.0.19045.4291/22H2/2022Update)
AMD Ryzen 5 2600, 1 CPU, 12 logical and 6 physical cores
.NET SDK 8.0.204
  [Host]     : .NET 8.0.4 (8.0.424.16909), X64 RyuJIT AVX2
  Job-LXTTHC : .NET 8.0.4 (8.0.424.16909), X64 RyuJIT AVX2
Method Runtime Mean Error StdDev Gen0 Allocated
CamelCase_Minerals_StringCases .NET 8.0 153.0 ns 1.32 ns 1.03 ns 0.0343 144 B
PascalCase_Minerals_StringCases .NET 8.0 159.2 ns 2.11 ns 1.98 ns 0.0343 144 B
SnakeCase_Minerals_StringCases .NET 8.0 187.9 ns 1.12 ns 1.00 ns 0.0362 152 B
KebabCase_Minerals_StringCases .NET 8.0 202.1 ns 1.94 ns 1.82 ns 0.0362 152 B
TrainCase_Minerals_StringCases .NET 8.0 213.2 ns 1.22 ns 1.08 ns 0.0362 152 B
- - - - - - -
PascalCase_CaseExtensions .NET 8.0 517.7 ns 4.23 ns 3.96 ns 0.0973 408 B
KebabCase_CaseExtensions .NET 8.0 529.3 ns 3.52 ns 3.29 ns 0.0992 416 B
SnakeCase_CaseExtensions .NET 8.0 531.2 ns 4.56 ns 4.26 ns 0.0992 416 B
TrainCase_CaseExtensions .NET 8.0 533.5 ns 5.08 ns 4.50 ns 0.0992 416 B
CamelCase_CaseExtensions .NET 8.0 549.7 ns 6.09 ns 5.69 ns 0.0973 408 B

Versioning

We use SemVer for versioning. For the versions available, see the branches on this repository.

Authors

  • Szymon Hałucha - Maintainer

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

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
0.2.1 57 6/10/2024
0.2.0 59 6/10/2024
0.1.0 97 5/15/2024

First release