blog
Ottorino Bruni  

Nuget TextCase library for .NET

I have often used and created nuget packages in many companies and never had the desire or time to create/manage my own nuget package that could help other fellow developers.

So i decide to create the TextCase library for .NET, it helps changing the cases of existing texts.

Nuget TextCase library for .NET

There are the cases currently available:

  • UpperCase
  • LowerCase
  • TitleCase
  • CapitaliseCase
  • CapitaliseWordsCase
  • ReverseCase
  • AlternateCase
  • CamelCase
  • PascalCase
  • KebabCase
  • SnackCase
  • HashtagCase

It’s possible to count in the text:

  • number of characters
  • number of words
  • number of letters
  • number of sentences

These are some examples how to use the library:

// 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();

// 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();

How to get TextCase from Nuget ?

PM› Install-Package TextCase

 

Do you want to help me to improve this projet? Please feel free ???? to send in a Pull Request, or drop me an email.

 

If you think your friends/network would find this useful, please share it with them. I’d really appreciate it.

Thanks for reading! ????

Leave A Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.