Manipulating Strings in C#—Uppercasing and Lowercasing
Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio
Uppercasing and Lowercasing
You can easily produce a version of a string where all the characters are uppercase or all the characters are lowercase.
To produce a string in either uppercase or lowercase form:
- 1. Declare a new string variable.
- 2. Type
= str.ToUpper();or= str.ToLower()accordingly, wherestris a variable holding the original string (Figure 4.55).

- Figure 4.55. The
ToUpperfunction creates a new string object from the original where all characters are in uppercase.
Tip
- The
ToUpperandToLowerfunctions don't change the original string. They produce new strings (and therefore new string buffers) with the characters' case modified.
- The
|

