Convert text to uppercase
Give these short labels the same letter case. All four inputs use plain English letters and digits.
ToUpperInvariant
Simple example
Change the case of two letters.
Start'ab'
ResultAB
using System;
Console.WriteLine("ab".ToUpperInvariant());
AB
Advertisements
Everyday examples
Make the bus label match the route board.
Start'bus'
ResultBUS
using System;
Console.WriteLine("bus".ToUpperInvariant());
BUS
Give an art shelf the same lettering as the other shelves.
Start'art'
ResultART
using System;
Console.WriteLine("art".ToUpperInvariant());
ART
Normalize the letters in a ticket code and keep its digits.
Start'b12'
ResultB12
using System;
Console.WriteLine("b12".ToUpperInvariant());
B12
Run the example
dotnet new console --output Lesson
cp Program.cs Lesson/Program.cs
dotnet run --project Lesson