CaseConverter 1.0.6
See the version list below for details.
dotnet add package CaseConverter --version 1.0.6
NuGet\Install-Package CaseConverter -Version 1.0.6
<PackageReference Include="CaseConverter" Version="1.0.6" />
paket add CaseConverter --version 1.0.6
#r "nuget: CaseConverter, 1.0.6"
// Install CaseConverter as a Cake Addin #addin nuget:?package=CaseConverter&version=1.0.6 // Install CaseConverter as a Cake Tool #tool nuget:?package=CaseConverter&version=1.0.6
Case Converter for .NET
“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 and Train-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
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- 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 | Versions 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. |
-
.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.