New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

Minerals.StringCases

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Minerals.StringCases

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

Source
nugetNuGet
Version
0.2.2
Version published
Maintainers
1
Created
Source

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.2.2" />

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.2.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.4412/22H2/2022Update)
AMD Ryzen 5 2600, 1 CPU, 12 logical and 6 physical cores
.NET SDK 8.0.301
  [Host]     : .NET 8.0.6 (8.0.624.26715), X64 RyuJIT AVX2
  Job-KUHBVV : .NET 8.0.6 (8.0.624.26715), X64 RyuJIT AVX2

Runtime=.NET 8.0
MethodMeanErrorStdDevGen0Allocated
PascalCase_Minerals_StringCases158.4 ns0.95 ns0.79 ns0.0343144 B
CamelCase_Minerals_StringCases167.4 ns1.94 ns1.72 ns0.0343144 B
SnakeCase_Minerals_StringCases182.4 ns0.71 ns0.63 ns0.0362152 B
KebabCase_Minerals_StringCases196.0 ns1.75 ns1.55 ns0.0362152 B
TrainCase_Minerals_StringCases206.1 ns2.62 ns2.46 ns0.0362152 B
------
PascalCase_CaseExtensions505.9 ns1.83 ns1.71 ns0.0973408 B
KebabCase_CaseExtensions506.1 ns1.68 ns1.49 ns0.0992416 B
CamelCase_CaseExtensions520.6 ns4.91 ns4.59 ns0.0973408 B
SnakeCase_CaseExtensions525.1 ns3.05 ns2.55 ns0.0992416 B
TrainCase_CaseExtensions527.3 ns2.47 ns2.06 ns0.0992416 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.

Keywords

string

FAQs

Package last updated on 23 May 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts