CaseConverter 1.0.9

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

// Install CaseConverter as a Cake Tool
#tool nuget:?package=CaseConverter&version=1.0.9

Case Converter for .NET Build status AppVeyor tests GitHub

“Naming Conventions is one of the two hard things in Computer Science” - Jeff Atwood (Stack Overflow Co-founder)*.

This library is designed to make it easier to convert the different case conventions in c# / .net through some simple to use string extension methods.

Simple string extension library designed to make it easy to convert strings between different cases such as camelCase, snake_case, kebab-case, PascalCase, Train-Case and Title Case.

This is a .NET STANDARD 2.1 Library

Installation

NuGet:

Install-Package CaseConverter

dotnet CLI

dotnet add package CaseConverter

Usage

using CaseConverter;

Console.WriteLine("Hello World!".ToCamelCase());
Console.WriteLine("Hello World!".ToSnakeCase());
Console.WriteLine("Hello World!".ToKebabCase());
Console.WriteLine("Hello World!".ToPascalCase());
Console.WriteLine("Hello World!".ToTitleCase());
Console.WriteLine("Hello World!".ToTrainCase());

String extensions:

  • string.ToSnakeCase() Converts any string to snake_case.
  • string.ToCamelCase() Converts any string to camelCase optionally removing whitespace.
  • string.ToKebabCase() Converts any string to kebab-case.
  • string.ToPascalCase() Converts any string to PascalCase.
  • string.ToTrainCase() Converts any string to Train-Case.
  • string.ToTitleCase() Converts any string to Title Case. Wrapper for TextInfo.ToTitleCase()

Supplementary string extensions included:

  • string.PascalCaseSingleWord() Convert a single word to Pascal Case.
  • string.InsertCharacterBeforeUpperCase() Insert any character before all upper space characters in a string.
  • string.InsertSpaceBeforeUpperCase() Insert a space before all upper space characters in a string.
  • string.SplitCamelCase() Split a string by Uppercase whilst dealing correctly with acronyms.
  • string.Replace() Replace specific characters found in a string.
  • string.ReplaceWhitespace() C Replace all whitespace in a string.
  • string.InsertCharacterBeforeUpperCase() Converts a string to Title Case.
  • string.IsAllUpper() Test to determine if a string is all upper case.
  • string.SnakeCaseToCamelCase() Convert SnakeCase to CamelCase.
  • string.FirstCharToLowerCase() Convert the first character in a string to lower case.
  • string.FirstCharToUpperCase() Convert the first character in a string to upper case.

I make no claims about the speed and efficiency of the included string extensions but welcome any pull requests that make improvements.

Tests

To run tests:

dotnet test

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request 😄

License

The MIT License (MIT) See LICENCE file for Licence (MIT Licence)

© 2021 Captive Reality Ltd. All Rights Reserved. Author: Mark Castle

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 netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen 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.1

    • 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
2.0.1 47,036 4/22/2023
2.0.0 122 4/22/2023
1.0.11 320 4/21/2023
1.0.10 7,084 11/6/2021
1.0.9 406 11/6/2021
1.0.6 265 11/6/2021
1.0.5 306 11/6/2021