Home >Backend Development >C#.Net Tutorial >How to convert uppercase letters to lowercase letters using C#?

How to convert uppercase letters to lowercase letters using C#?

PHPz
PHPzforward
2023-09-02 10:45:02926browse

如何使用 C# 将大写字母转换为小写字母?

To convert uppercase letters to lowercase letters, use the ToLower() method in C#.

Assume your string is -

str = "TIM";

To convert the uppercase string above to lowercase, use the ToLower() method -

Console.WriteLine("Converted to LowerCase : {0}", str.ToLower());

The following is the conversion in C# Codes for character case -

Example

using System;
using System.Collections.Generic;
using System.Text;

namespace Demo {
   class MyApplication {
      static void Main(string[] args) {
         string str;
         str = "TIM";
         Console.WriteLine("UpperCase : {0}", str);

         // convert to lowercase
         Console.WriteLine("Converted to LowerCase : {0}", str.ToLower());
         Console.ReadLine();
      }
   }
}

The above is the detailed content of How to convert uppercase letters to lowercase letters using C#?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete