In this article, you will learn ways to convert a string to different cases, for example Upper case, Lower case, Title case (capitalize each word), Camel case, Pascal case, Sentence case, Toggle case or converting a string to a sentence using C# code.
We can convert a string to different cases using C# code or Visual Studio shortcuts like Ctrl + U & Ctrl + Shift + U. Along with it, we can also use other combination box selection (vertical selection or rectangular selection) Ctrl + Shift + Arrow (Left Arrow, Right Arrow, Up Arrow, Down Arrow) or you can also use Ctrl + Shift + Mouse pointer to select a rectangular area. In the below image, you can see how box selection can be used with change case shortcuts. This is not limited and if you do not want to just convert case of string but convert a string to a sentence you can use Humanizer for which if we combine all these, it will look something similar t the image shown below. Let’s start one by one to understand it in a better way. Convert a string to Lower case
Convert a string to Upper case
Converting Pascal Case to Camel Case
Until now, you may have been thinking that if we can achieve something easily using String class or TextInfo class methods then why I am using Humanizer? Let me show you some examples after which you will understand why we need Humanizer.
Apart from these examples, you can do hundreds of other types of conversion and formatting using Humanizer. For more details, visit here
Diving Into OOP