TextCase 1.1.0

dotnet add package TextCase --version 1.1.0
                    
NuGet\Install-Package TextCase -Version 1.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="TextCase" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TextCase" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="TextCase" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TextCase --version 1.1.0
                    
#r "nuget: TextCase, 1.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.
#:package TextCase@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=TextCase&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=TextCase&version=1.1.0
                    
Install as a Cake Tool

TextCase

.NET NuGet Nuget

TextCase is a powerful .NET library designed to simplify text manipulation by providing a variety of case conversion methods.

Key Features

  • Wide Range of Conversions: Transform text into 21 different cases including UpperCase, LowerCase, TitleCase, CamelCase, PascalCase, Base64 encoding/decoding, DotCase, ROT13, and more.
  • Text Analysis: Easily count characters, words, unique words, letters, sentences, paragraphs, numbers, and estimate reading time.
  • Easy Integration: Simple and intuitive API that integrates seamlessly with your .NET applications.
  • List Available Conversions: Easily retrieve all supported text cases programmatically.

Available Conversions

  • UpperCase: Converts text to uppercase.
  • LowerCase: Converts text to lowercase.
  • TitleCase: Capitalizes the first letter of each word.
  • CamelCase: Converts text to camelCase.
  • PascalCase: Converts text to PascalCase.
  • KebabCase: Converts text to kebab-case.
  • SnackCase: Converts text to snack_case.
  • HashTagCase: Converts text to #HashTagCase.
  • ConstantCase: Converts text to CONSTANT_CASE.
  • CobolCase: Converts text to COBOL-CASE.
  • InverseCase: Alternates case starting with lowercase.
  • TrainCase: Converts text to Train-Case.
  • CapitaliseCase: Capitalizes the first letter of the text.
  • CapitaliseWordsCase: Capitalizes the first letter of each word.
  • ReverseCase: Reverses the text.
  • AlternateCase: Alternates case starting with uppercase.
  • Base64EncodeCase: Encodes text to Base64.
  • Base64DecodeCase: Decodes Base64 text.
  • DotCase: Converts text to dot.case.
  • Rot13Case: Applies the ROT13 substitution cipher.

Text Analysis Examples:

  • number of characters
  • number of words
  • number of unique words
  • number of letters
  • number of sentences
  • number of paragraphs
  • number of numeric digits
  • estimated reading time

Usage Examples:

// YOU TALKING TO ME?
TextCase.Convert("You talking to me?", Case.UpperCase);
"You talking to me?".ToUpperCase();

// you talking to me?
TextCase.Convert("You talking to me?", Case.LowerCase);
"You talking to me?".ToLowerCase();

// You Talking To Me?
TextCase.Convert("You talking to me?", Case.TitleCase);
"You talking to me?".ToTitleCase();

// You talking to me?
TextCase.Convert("You talking to me?", Case.CapitaliseCase);   
"You talking to me?".ToCapitaliseCase();

// You Talking To Me?
TextCase.Convert("You talking to me?", Case.CapitaliseWordsCase); 
"You talking to me?".ToCapitaliseWordsCase();

// ?em ot gniklat uoY
TextCase.Convert("You talking to me?", Case.ReverseCase);         
"You talking to me?".ToReverseCase();

// YoU TaLkInG To mE?
TextCase.Convert("You talking to me?", Case.AlternateCase);       
"You talking to me?".ToAlternateCase();

// youTalkingToMe?
TextCase.Convert("You talking to me?", Case.CamelCase);           
"You talking to me?".ToCamelCase();

// YouTalkingToMe?
TextCase.Convert("You talking to me?", Case.PascalCase);          
"You talking to me?".ToPascalCase();

// you-talking-to-me?
TextCase.Convert("You talking to me?", Case.KebabCase);           
"You talking to me?".ToKebabCase();

// you_talking_to_me?
TextCase.Convert("You talking to me?", Case.SnackCase);           
"You talking to me?".ToSnackCase();

// #You #talking #to #me?
TextCase.Convert("You talking to me?", Case.HashTagCase);   
"You talking to me?".ToHashTagCase();

// YOU_TALKING_TO_ME
TextCase.Convert("You talking to me?", Case.ConstantCase);   
"You talking to me?".ToConstantCase();

// YOU-TALKING-TO-ME
TextCase.Convert("You talking to me?", Case.CobolCase);   
"You talking to me?".ToCobolCase();

// yOu TaLkInG tO mE?
TextCase.Convert("You talking to me?", Case.InverseCase);   
"You talking to me?".ToInverseCase();

// You-Talking-To-Me
TextCase.Convert("You talking to me?", Case.TrainCase);   
"You talking to me?".ToTrainCase();

// Encode text to Base64
TextCase.Convert("You talking to me?", Case.Base64EncodeCase);
"You talking to me?".ToBase64EncodeCase();

// Decode Base64 text
TextCase.Convert("WW91IHRhbGtpbmcgdG8gbWU/", Case.Base64DecodeCase);
"WW91IHRhbGtpbmcgdG8gbWU?".ToBase64DecodeCase();

// you.talking.to.me
TextCase.Convert("You talking to me?", Case.DotCase);
"You talking to me?".ToDotCase();

// Lbh gnyxvat gb zr?
TextCase.Convert("You talking to me?", Case.Rot13Case);
"You talking to me?".ToRot13Case();

Text Analysis Functions

// Text Count
TextCase.GetTextCount("You talking to me?");  
"You talking to me?".GetTextCount();  

// Words Count
TextCase.GetWordsCount("You talking to me?");
"You talking to me?".GetWordsCount();

// Letters Count
TextCase.GetLettersCount("You talking to me?");
"You talking to me?".GetLettersCount();

// Sentences Count
TextCase.GetSentencesCount("You talking to me?");
"You talking to me?".GetSentencesCount();

// Paragraphs Count
TextCase.GetParagraphsCount("You talking to me?");
"You talking to me?".GetParagraphsCount();

// Unique Words Count
TextCase.GetUniqueWordsCount("the cat sat on the mat");
"the cat sat on the mat".GetUniqueWordsCount();

// Numbers Count
TextCase.GetNumbersCount("I have 2 cats and 10 dogs");
"I have 2 cats and 10 dogs".GetNumbersCount();

// Reading Time (returns TimeSpan, default 200 wpm)
TextCase.GetReadingTime("You talking to me?");
"You talking to me?".GetReadingTime();

GetAllCases The GetAllCases method has been introduced to allow users to retrieve a complete list of all available text case conversions.

var allCases = TextCase.GetAllCases();

foreach (var textCase in allCases)
{
    Console.WriteLine(textCase);
}

Get it on NuGet:

PM> Install-Package TextCase

Feedback and Contribution

Please feel free to send in a Pull Request, or drop me an email. Cheers!

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.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
1.1.0 63 3/6/2026
1.0.11 2,341 5/27/2024
1.0.10 158 5/25/2024
1.0.9 160 5/24/2024
1.0.8 158 5/23/2024
1.0.7 146 5/12/2024
1.0.6 150 5/12/2024
1.0.5 1,278 9/13/2023
1.0.4 201 9/12/2023
1.0.3 549 4/10/2021
1.0.2 483 4/2/2021
1.0.1 466 4/2/2021
1.0.0 476 4/1/2021