Convert Lower Case Text To Upper Case C#

This blog post will learn how to convert a text string from lower case to upper case using C# build in methods.

Upper Case

In the below code, I have a string variable with a text that is all lower case and I will convert it to upper case using the .ToUpper() function.

using System;

string mytext = "hello world";
string mynewtext = mytext.ToUpper();
Console.WriteLine(mynewtext);

Lower Case

To do the opposite we can use the toLower() function as shown below.

using System;

string mytext = "hello world";
string mynewtext = mytext.ToLower();
Console.WriteLine(mynewtext);

Published
Categorized as C#, C# 9

Leave a comment

Your email address will not be published. Required fields are marked *